There are two standard algorithm that I know of that do lexicographic permutations. 1. Knuth's Algorithm L (which STL's next_permutation implements) - http://blog.bjrn.se/2008/04/lexicographic-permutations-using.html. This is quite easy to implement to.
2. Here is another one from wikipedia - http://en.wikipedia.org/wiki/Permutation#Lexicographical_order_generation. On Fri, Sep 18, 2009 at 6:55 PM, 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. > > > > -- Yesterday is History. Tomorrow is a Mystery. Today is a Gift! That is why it is called the Present :). http://sites.google.com/site/ramaswamyr --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
