Abstract
We study a class of recursive permutation generation methods which construct a sequence of alln! permutations ofn elements by repeatedly generating all permutations of the elements in the firstn−1 positions and exchanging one of them with the element in then-th position. We give a general principle which enables us to obtain a whole class of permutation generation methods. This class includes the well-known algorithms of Wells and Heap as special cases, but contains also many new simple algorithms. Moreover, we are able to produce permutation generation methods with prescribed properties concerning the change that should be made in order to skip a block ofm! permutations with fixed elements in positionsm+1, …,n. For any method in our class, this change is a single transposition for any oddm>1, and a cyclic shift along a cycle of lengthm for any evenm.
Zusammenfassung
Wir untersuchen eine Klasse rekursiver Methoden zur Erzeugung von Permutationen, welche eine Folge allern! Permutationen vonn Elementen dadurch konstruieren, daß wiederholt alle Permutationen der Elemente in den erstenn−1-Positionen erzeugt werden und dann eines von ihnen mit dem Element in dern-ten Position vertauscht wird. Wir geben ein allgemeines Prinzip an, welches es uns ermöglicht, eine ganze Klasse von Methoden zur Erzeugung von Permutationen zu erhalten. Diese Klasse schließt die bekannten Algorithmen von Wells und Heap als Spezialfälle ein, enthält aber auch viele neue einfache Algorithmen. Darüber hinaus sind wir in der Lage, Methoden mit vorgegebenen Eigenschaften zu produzieren, welche die Änderung betreffen, die gemacht werden sollte, um einen Block vonm! Permutationen mit festen Elementen in den Positionenm+1, …,n zu überspringen. Für jede Methode in unserer Klasse ist diese Änderung eine einzelne Transposition, fallsm>1 ungerade ist, und eine zyklische Verschiebung entlang eines Zyklus' der Längem, fallsm gerade ist.
Similar content being viewed by others
References
Boothroyd, J.: PERM (Algorithm 6). Computer Bulletin9, 104 (1965).
Boothroyd, J.: Permutation of the elements of a vector (Algorithm 29); Fast permutation of the elements of a vector (Algorithm 30). Computer J.10, 310–312 (1967).
Heap, B. R.: Permutations by interchanges. Computer J.6, 293–294 (1963).
Sedgewick, R.: Permutation generation methods. ACM Computing Surveys9, 137–163 (1977).
Wells, M. B.: Generation of permutations by transposition. Math. Comp.15, 192–195 (1961).
Author information
Authors and Affiliations
Additional information
This work has been done while the author was on leave as a Fulbright Scholar at Coordinated Science Laboratory, University of Illinois at Urbana-Champaign.
Rights and permissions
About this article
Cite this article
Lipski, W. More on permutation generation methods. Computing 23, 357–365 (1979). https://doi.org/10.1007/BF02254864
Received:
Revised:
Issue Date:
DOI: https://doi.org/10.1007/BF02254864