Computer Science Canada All combinations |
Author: | Flikerator [ Sat Oct 14, 2006 2:40 pm ] |
Post subject: | All combinations |
How would I find all the combinations of "A, B, C, D, E, F, and G"? Using each one only once. I know it could be done with recursion; but Im still fumbling with that concept. Any help would be greatly appreciated. I think there are 720 combinations, I just need each one, one by one. |
Author: | Tony [ Sat Oct 14, 2006 2:54 pm ] |
Post subject: | |
A really simple example of recursion is found over at the wiki It is an important consept though, and it would be best to understand it, over slapping together a work-around. I'm assuming that you know at least a little bit about recursion, so where should we start helping you? |
Author: | Flikerator [ Sat Oct 14, 2006 3:22 pm ] |
Post subject: | |
Haha nice example ![]() I understand the concept of recursion, I just don't have the...I don't know, foundation. I haven't really implemented it before into a program. I can logic it out in my head a little; I know recursion could do it, I just don't know how. B C D E F G I have the idea that if it was (It always starts with A); 2 3 4 5 6 7 I would start at two and then declare all of them at the highest. So the first one would be; {2,3,4,5,6,7|B,C,D,E,F,G} The second time it would take the highest minus one, and then maybe take the left over. {2,3,4,5,7,6|B,C,D,E,G,F}. Each time it goes back a column it would have to do it 1 more time, because it deals with 1 more number. At first it was G and F. It does that twice. When it has three E,F,G it would have to do it 6 times. With four it would have to do it 24 times. Something like that, unsure where to start. I'm still trying though. |