Generating Gray Codes in O(1) Worst-Case Time per Word
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.
Unable to display preview. Download preview PDF.
- 1.Gray, F.: Pulse Code Communication. U.S. Patent 2 632 058 (March 17, 1953)Google Scholar
- 9.Vajnovszki, V., Walsh, T.R.: A loopless two-close Gray code algorithm for listing k-ary Dyck words. Submitted for publicationGoogle Scholar
- 13.Walsh, T.R.: A Simple Sequencingan d Ranking Method that Works on Almost All Gray Codes. Research Report No. 243, Department of Mathematics and Computer Science, Université du Québec à Montréal (April 1995)Google Scholar
- 20.Williamson, S.G.: Combinatorics for Computer Science. Computer Science Press, Rockville (1985)Google Scholar
- 22.Vajnovszki, V.: Generating Multiset Permutations. Accepted for publication in Theoretical Computer ScienceGoogle Scholar