An O(1) Time Algorithm for Generating Multiset Permutations

  • Authors:
  • Tadao Takaoka

  • Affiliations:
  • -

  • Venue:
  • ISAAC '99 Proceedings of the 10th International Symposium on Algorithms and Computation
  • Year:
  • 1999

Quantified Score

Hi-index 0.00

Visualization

Abstract

We design an algorithm that generates multiset permutations in O(1) time from permutation to permutations, using only data structures of arrays. The previous O(1) time algorithm used pointers, causing O(n) time to access an element in a permutation, where n is the size of permutations. The central idea in our algorithm is tree traversal. We associate permutations with the leaves of a tree. By traversing this tree, going up and down and making changes when necessary, we spend O(1) time from permutation to permutation. Permutations are generated in a one-dimensional array.