
N possibilities
I have a problem solving a proble...
I wopuld great full to any one who can provide me with the algorithm and tips to solve ths..
Conside that a user enters n numbers example(2,56 ,51 ,6,1,2,3,4,5,6) etc etc.. Well i want the program to find all the possible combination using the given numbers. If there are 2 numbers 1 and 2 and 3 then possibiliies such as 12,13,123,21,23,213,31,3,1,2,321,123 etc etc can be formed.. I want this to work for N numbers.. please help me...

I think factorials is what you need. n!
Dunno if that is provided in any header, its fairly easy to write though...n! is the number of permutations of n items. I'll leave it up to you as an exercise to find. Man I sound like my math teacher. :D



I think i need more help..

The code silentstrike proposed is almost exactly what you need. Take another look.
