Possible Duplicate:
Combination Generator in Linq
I am looking of an algorithm (using C#) that can
find all the combinations of specified numbers.
Example:
Numbers:
1 2 3
Combinations:
1
2
3
12
13
21
23
31
32
123
132
213
231
312
321
Only rule: No repetitions of numbers
I have looked around Google, Stackoverflow, as well as numerous other sites.
I would list some of my code, but I have had no success getting anything to work along the right lines.
EDIT: The intention of this is using the generated numbers as the positions of characters in a word. I am creating a word finder, so basically this is what it is being used for:
Program generates:
0
1
01
10
From numbers: 0 1
The program got the numbers 0 and 1 from the user inputting for instance "no".
Example code:
string input = Console.ReadLine();
int size = input.Length; //This is where the 0 and 1 come from
Therefore the different combinations would rearrange the letters, using the length of the inputted word as the base, then comparing it to a word list, I could find existing words.