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

Mar 8 2016 12:53 PM
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)