In c++:
string s ="ABCXDEF";
sort(s.begin(), s.end());
do {
cout << s;
} while (next_permutation(s.begin(), s.end() );
For languages that don't have the library built in, or if you really
want to code it yourself, an easy way is to use backtracking:
http://en.wikipedia.org/wiki/Backtracking . (Recursion).
On 8 mayo, 12:54, Shoubhik <[email protected]> wrote:
> Could somebody post an algorithm/code for obtaining permutations of an
> n-letter string .
--
You received this message because you are subscribed to the Google Groups
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-code?hl=en.