English

Loopless Gray Code Enumeration and the Tower of Bucharest

Discrete Mathematics 2018-11-26 v1 Data Structures and Algorithms

Abstract

We give new algorithms for generating all n-tuples over an alphabet of m letters, changing only one letter at a time (Gray codes). These algorithms are based on the connection with variations of the Towers of Hanoi game. Our algorithms are loopless, in the sense that the next change can be determined in a constant number of steps, and they can be implemented in hardware. We also give another family of loopless algorithms that is based on the idea of working ahead and saving the work in a buffer.

Cite

@article{arxiv.1604.06707,
  title  = {Loopless Gray Code Enumeration and the Tower of Bucharest},
  author = {Felix Herter and Günter Rote},
  journal= {arXiv preprint arXiv:1604.06707},
  year   = {2018}
}

Comments

16 pages plus 8 pages of appendix with Python programs, 6 figures. A Python script to extract the program code from the LaTeX file is attached to the sources

R2 v1 2026-06-22T13:38:44.319Z