2
Answers

How can I loop over N objects using 3 objects each iteration

Hello
 
Let's suppose I have 4 objects, and I want loop over these objects using a function involving 3 objects in each call as follows:
 
  1. MyFunction(object1, object2 , object3);
  2. MyFunction(object1, object2 , object4);
  3. ...
  4. MyFunction(object2, object1 , object3);
  5. MyFunction(object2, object1 , object4);
  6. ...
  7. MyFunction(object4, object2 , object1);
  8. MyFunction(object4, object2 , object3) ;
 
 What is the general algorithm for this ?
 
Thanks at advance
Answers (2)