Name: Anonymous 2007-12-23 9:33
Hi, I've been trying to come up with a way to generate all combinations of the letters in a word. I've looked up anagrams solvers but most just compare the number of letters in each. I'll I can think is that it has to do something with factorials.
abcd
abdc
acbd
acdb
adbc
adcb
bacd
I've been trying stuff like this but realized 2 nested loops were only 16 and not 24 combinations. Any links, suggestions, or code would be helpful thanks.
abcd
abdc
acbd
acdb
adbc
adcb
bacd
I've been trying stuff like this but realized 2 nested loops were only 16 and not 24 combinations. Any links, suggestions, or code would be helpful thanks.
char[] anagram = {'a','b','c','d'};
for (int y = 4; y > 0; y--)
{
for (int x = 3; x > 0; x--)
{
switchChars(anagram, x, y);
c++;
Console.WriteLine(anagram);
}
}