Jump to content

Permutations: Difference between revisions

Line 3,647:
Full non-recursive algorithm generating permutation in reversed lexicographical order.
Taken from here: [https://habrahabr.ru/post/275331/]. It's a little bit modified algorythm of Narayana Pandit [https://en.wikipedia.org/wiki/Narayana_Pandit]. It reveres a string and works until a and b are not equal. It searches
a new permutation directly (first internal cycle) as we do it on a sheet of paper. You can use English alphabet instead of digits. Author: I. Gavryushin aka dcc0.
 
<lang php>
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.