Loading...

algogeeks@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

[algogeeks] Re: How to find all possible permutations of a given string in alphabetical order? MrM Sat Sep 19 06:03:04 2009

Use back-tracking !
write a function that make all permutations in alphabetically order
from "i"-th position until end ("i" is function's input)!
you should put all the characters from "i"-th position until end of
string at "i"-th position once, and each time re-call the function
with "i+1" !
the recursion finishes when i > N (N = length of string), and you have
to record the string when you reached this condition !

Hope it helps ^-^

On Sep 19, 5:55 am, eSKay <[EMAIL PROTECTED]> wrote:
> This problem might be trivial for some but I've always found it
> difficult to formulate.
>
> What good algorithm should be used to approach this?
>
> Please let me know your approach. I want to know how to think about
> this algorithm.
>
> I do not need the code.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---