Thanks Coskun, Yeah that helped! I was able to print all options quite easily once I implemented the RD algorithm. Basically I found all combinations of C(7, 3) then for each of those combinations I simply added the "other" 4 values.
Here's the output... Total combinations: 35 1. [a, b, c] --> [d, e, f, g] 2. [a, b, d] --> [c, e, f, g] 3. [a, b, e] --> [c, d, f, g] 4. [a, b, f] --> [c, d, e, g] 5. [a, b, g] --> [c, d, e, f] 6. [a, c, d] --> [b, e, f, g] 7. [a, c, e] --> [b, d, f, g] 8. [a, c, f] --> [b, d, e, g] 9. [a, c, g] --> [b, d, e, f] 10. [a, d, e] --> [b, c, f, g] 11. [a, d, f] --> [b, c, e, g] 12. [a, d, g] --> [b, c, e, f] 13. [a, e, f] --> [b, c, d, g] 14. [a, e, g] --> [b, c, d, f] 15. [a, f, g] --> [b, c, d, e] 16. [b, c, d] --> [a, e, f, g] 17. [b, c, e] --> [a, d, f, g] 18. [b, c, f] --> [a, d, e, g] 19. [b, c, g] --> [a, d, e, f] 20. [b, d, e] --> [a, c, f, g] 21. [b, d, f] --> [a, c, e, g] 22. [b, d, g] --> [a, c, e, f] 23. [b, e, f] --> [a, c, d, g] 24. [b, e, g] --> [a, c, d, f] 25. [b, f, g] --> [a, c, d, e] 26. [c, d, e] --> [a, b, f, g] 27. [c, d, f] --> [a, b, e, g] 28. [c, d, g] --> [a, b, e, f] 29. [c, e, f] --> [a, b, d, g] 30. [c, e, g] --> [a, b, d, f] 31. [c, f, g] --> [a, b, d, e] 32. [d, e, f] --> [a, b, c, g] 33. [d, e, g] --> [a, b, c, f] 34. [d, f, g] --> [a, b, c, e] 35. [e, f, g] --> [a, b, c, d] thanks! Noam On Sep 14, 2:49 am, "Coskun Gunduz" <[EMAIL PROTECTED]> wrote: > Hi, > > try to see the problem in a different way; choosing 3 students from a group > of 7. This is a simpler point of view. Then let the other 4 students make > another group of size 4. > > I recommend Revolving Door algorithm to find C(7,3), which is covered at > Knuth's TAOCP pre-fascicle 3a. There are also other combinatorial algorithms > in that fascicle. > > HTH, > > coskun... > > On Sun, Sep 14, 2008 at 8:31 AM, Noam Wolf <[EMAIL PROTECTED]> wrote: > > > Let's say I have 7 students and I would like to find out how many > > different ways I can arrange them in two groups, one of size 3 and one > > of size 4. The answer is simple, using binomial coefficient we can > > compute: > > > 7 choose 4 = (7 / 4) = 35 > > and > > 7 choose 3 = (7 / 3) = 35 > > > Now, I would like to print, to screen, all possible permutations... > > I'm unsure of the solution to this. There seem to be a couple of > > approaches: > > > 1. Greedy, start moving "students" from one group to the other and > > keep track of each permutation > > 2. Recursive, recursively generate all possible permutations and save > > them and then figure out which are "good" > > 3. Dynamic programming, create a graph that represents all possible > > transitions and build out the viable ones. > > > How do I implement/solve this problem using any of these approaches? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---
