are we like given a dictionary or something?
if we are, its quite simple...
1. load the dictionary into an array.
2. sort the given string lexicographically. call it s
3. for each string t in the array,
u = sort t
if s=u then print t
then again, if we are asked to print all permutations, we can do it
recursively...or there is Johnson-Trotter:
http://en.wikipedia.org/wiki/Steinhaus%E2%80%93Johnson%E2%80%93Trotter_algorithm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" 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/algogeeks
-~----------~----~----~----~------~----~------~--~---