Generating gray codes in o(1) worst-case time per word

  • Authors:
  • Timothy Walsh

  • Affiliations:
  • Department of Computer Science, UQAM, Montreal, Quebec, Canada

  • Venue:
  • DMTCS'03 Proceedings of the 4th international conference on Discrete mathematics and theoretical computer science
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

We give a definition of Gray code that, unlike the standard "minimal change" definition, is satisfied by the word-lists in the literature called "Gray codes" and we give several examples to illustrate the various concepts of minimality. We show that a non-recursive generation algorithm can be obtained for a word-list such that all the words with the same prefix (or, equivalently, suffix) are consecutive and that the Bitner-Ehrlich-Reingold method of generating each word in a time bounded by a constant works under the additional condition that in the interval of words with the same prefix or suffix the next letter assumes at least two values. Finally we generalize this method so that it works under a weaker condition satisfied by almost all the Gray codes in the literature: if the next letter assumes only one value, then the interval contains only one word.