I would like a C# algorithm that re-arranges the chars in a string that is dynamic in length. Having trouble finding one and I know there has to be one out there.
The algorithm has to realign elements to form new strings in all possible combinations.
For instance, “cat” would produce the following:
cat cta tca tac act atc
This is a fairly frequently asked question here. Try doing a search on “permutation” and you’ll find a lot of good answers about how to do this in various languages.
There is a library of permutation and combination algorithms in C# here:
http://www.codeproject.com/KB/recipes/Combinatorics.aspx