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 -~----------~----~----~----~------~----~------~--~---
