I am trying to generate all the possible combinations of an array of characters. The input array has n characters, 5 <= n <= 7, and I would like to generate a second array A( C( n , 5 ) , 5 ) that contains all the C( n , 5 ) combinations. The order of the characters in the array isn't important.
Here is an example: input array: { A, B, C, D, E, F } , so n = 6 output array should be:
{A B C D E},
{A B C D F},
{A B C F E},
{A B F D E},
{A F C D E},
{F B C D E},
This is pretty simple for n=5 and n=6, but gets very complicated for n=7. Does anyone know how should I make this ?
Thanks
See Question&Answers more detail:os