Possible Duplicate:
Generate list of all possible permutations of a string
I need to work on a small algorithm project where I need to be able to list and write to a text file the possible combination of a given set of characters based on a given limit.
For example, if I enter the characters "a", "b", and "c" and set the limit to 3 the possible output would be:
a
b
c
aa
bb
cc
ab
ac
ba
bc
ca
cb
...
aaa
bbb
ccc
...
...
abc
acb
bac
bca
cab
cba
Until all possible combinations have been devised.
Writing this to a text file is no problem with me. Having an algorithm that would write the combination is something that I am quite not good at.
Appreciate in .NET (C# or VB) codes.
Thanks.
PS
On a side note, I wonder how long it would take for an application to create a string combination of all possible keyboard characters and how big the file would get to be.
Updated: I should also show character combination from n characters to the implied limit..