Abstract
A permutation π1 π2 ... π n is alternating if π1<π2>π3<π4 .... We present a constant average-time algorithm for generating all alternating permutations in lexicographic order. Ranking and unranking algorithms are also derived.
Similar content being viewed by others
References
L. Comtet:Advanced Combinatorics. D. Reidel, 1974.
R. C. Entringer:A combinatorial interpretation of the Euler and Bernoulli numbers. Nieuw Archief voor Wiskunde 14:241–246, 1966.
T. Hough and F. Ruskey:An efficient implementation of the Eades, Hickey, Read adjacent interchange combination generation algorithm. J. Combinat. Math. and Combinat. Computing, 4:79–86, 1988.
A. D. Kalvin and Y. L. Varol:On the generation of all topological sortings. J. Algorithms, 4:150–162, 1983.
R. Kemp:Fundamentals of the Average Case Analysis of Particular Algorithms. Wiley-Teubner, 1984.
D. E. Knuth:Sorting and Searching. Addison-Wesley, 1973.
D. E. Knuth and T. J. Buckholtz:Computing of Tangent, Euler, and Bernoulli numbers. Math. Computation, 21:663–688, 1967.
A. Nijenhuis and H. S. Wilf:Combinatorial Algorithms, 2nd Ed. Academic Press, 1978.
R. J. Ord-Smith:Generation of permutations in lexicographic order (algorithm 323). Comm. ACM, 2:117, 1968.
G. Pruesse and F. Ruskey:Transposition Generation of the Linear Extensions of Certain Posets. Technical Report DCS-91-IR, U. Victoria, 1988.
E. M. Reingold, J. Nievergelt, and N. Deo:Combinatorial Algorithms: Theory and Practice. Prentice-Hall, 1977.
F. Ruskey:Transposition Generation of Alternating Permutations. Technical Report DCS-90-IR. U. Victoria, 1988.
F. Ruskey and A. Proskurowski:Generating binary trees by transpositions. J. Algorithms, to appear.
R. Sedgewick:Permutation generation methods. Computing Surveys, 9:137–164, 1977.
H. S. Wilf:A unified setting for sequencing, ranking and selection algorithms for combinatorial objects. Advances in Math., 24:281–291, 1977.
S. Zaks:Lexicographic generation of ordered trees. Theoretical Computer Science, 10:63–82, 1980.
S. Zaks and D. Richards:Generating trees and other combinatorial objects lexicographically. SIAM J. Computing, 8:73–81, 1979.
Author information
Authors and Affiliations
Additional information
Research supported by the Natural Sciences and Engineering Research Council of Canada under grant A3379.