Logo PTI Logo FedCSIS

Proceedings of the 18th Conference on Computer Science and Intelligence Systems

Annals of Computer Science and Information Systems, Volume 35

A short note on computing permutations

,

DOI: http://dx.doi.org/10.15439/2023F5568

Citation: Proceedings of the 18th Conference on Computer Science and Intelligence Systems, M. Ganzha, L. Maciaszek, M. Paprzycki, D. Ślęzak (eds). ACSIS, Vol. 35, pages 979982 ()

Full text

Abstract. We discuss an algorithm for generating all permutations of numbers between 1 and N. The algorithm is short and efficient, yet its behavior is not obvious from the code, mostly owing to the recursion. The discussion touches upon a few interesting methodological issues and brings in an educational case study in recursion.

References

  1. D. E. Knuth, The Art of Computer Programming, Volume 4, Fascicle 2: Generating All Tuples and Permutations (Art of Computer Programming). Addison-Wesley Professional, 2005.
  2. L. Banachowski, A. Kreczmar, and W. Rytter, Analysis of Algorithms and Data Structures. Addison-Wesley Longman Publishing Co., Inc., 1991.
  3. P. Flajolet and R. Sedgewick, Analytic Combinatorics. Cambridge University Press, 2009.
  4. A. Oram and G. Wilson, Beautiful code: Leading programmers explain how they think. O’Reilly Media, Inc, 2007.
  5. G. Ehrlich, “Loopless algorithms for generating permutations, combinations, and other combinatorial configurations,” Journal of the ACM, vol. 20, no. 3, pp. 500–513, 1973.
  6. G. Mirkowska and A. Salwicki, Algorithmic Logic. PWN, Warszawa, 1987. [Online]. Available: http://lem12.uksw.edu.pl/wiki/Algorithmic Logic
  7. N. Dershowitz, “A simplified loop-free algorithm for generating permutations,” BIT Numerical Mathematics, vol. 15, no. 2, pp. 158–164, 1975.
  8. C. W. Ko and F. Ruskey, “Generating permulations of a bag by interchanges,” Information Processing Letters, vol. 41, no. 5, pp. 263–269, 1992.
  9. D. R. van Baronaigien and F. Ruskey, “Generating permutations with given ups and downs,” Discrete Applied Mathematics, vol. 36, no. 1, pp. 57–65, 1992.
  10. S. Effler and F. Ruskey, “A CAT algorithm for generating permutations with a fixed number of inversions,” Information Processing Letters, vol. 86, no. 2, pp. 107–112, 2003.
  11. O.-J. Dahl and K. Nygaard, “Simula,” in Encyclopedia of Computer Science. Wiley, 2003, pp. 1576–1578.
  12. D. Beazley and B. K. Jones, Python cookbook: Recipes for mastering Python 3. “O’Reilly Media, Inc.”, 2013.
  13. D. E. Knuth, “Literate programming,” The Computer Journal, vol. 27, no. 2, pp. 97–111, 1984.