Generating Gray Codes in O(1) Worst-Case Time per Word

  title={Generating Gray Codes in O(1) Worst-Case Time per Word},
  author={Timothy R. S. Walsh},
  • T. Walsh
  • Published in DMTCS 7 July 2003
  • Computer Science
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… 

ECO-based Gray codes generation for particular classes of words

The techniques presented here are complementary to that of [4]: it is less general but easy to describe, understand, implement and manipulate, and has the advantage that intermediate produced objects are still (smaller size) objects in the same class.

Flip-swap languages in binary reflected Gray code order

A loop-free two-close Gray-code algorithm for listing k-ary Dyck words

More restrictive Gray codes for necklaces and Lyndon words

Inside the Binary Reflected Gray Code: Flip-Swap Languages in 2-Gray Code Order

It is proved that any flip-swap language forms a cyclic 2-Gray code when listed in binary reflected Gray code (BRGC) order and a generic successor rule computes the next string when provided with a membership tester.

Restricted compositions and permutations: From old to new Gray codes

Gray codes and efficient exhaustive generation for several classes of restricted words. (Codes de gray et génération exhaustive pour certaines classes de mots sous contrainte)

The Steinhaus-Johnson-Trotter Gray code for permutations, when restricted by avoiding some set of patterns, still remains a (possibly less restricted) Gray code, and the main ingredients are used in the investigation of the Graycodeness.

Loop-free Gray code algorithm for the e-restricted growth functions

Two Reflected Gray Code-Based Orders on Some Restricted Growth Sequences

The first suffix partitioned Gray codes for restricted growth f unctions and ascent sequences are given; these latter sequences code various combinatorial classes as interval orders, upper triangular matrices without zero rows and zero columns whose non-negative integer entries sum up to n, and certain pattern-avoiding permutations.

On the exhaustive generation of generalized ballot sequences in lexicographic and Gray code order

It is shown that the Reected Gray Code order induces a cyclic 3-adjacent Gray code on both, the set of fixed length generalized ballot sequences and p-ary ballot sequences when p is even, that is, ordered list where consecutive sequences differ in at most 3 adjacent positions.



Gray Code Sequences of Partitions

Simple Combinatorial Gray Codes Constructed by Reversing Sublists

Three related results about simple combinatorial Gray codes constructed recursively by reversing certain sublists are presented and a new Gray code list of the partitions of a set into a fixed number of blocks is developed.

A Loopless Gray-Code Algorithm for Listing k-ary Trees

This paper presents the first loopless algorithm for listing the bit sequence representations of k-ary trees in a Gray-code order and is the only known algorithm that generates the bit sequences by homogeneous transpositions.

An Eades-McKay Algorithm for Well-Formed Parentheses Strings

Generation of Well-Formed Parenthesis Strings in Constant Worst-Case Time

  • T. Walsh
  • Computer Science
    J. Algorithms
  • 1998
Two nonrecursive versions of the Proskurowski and Ruskey algorithm for generating well-formed parenthesis strings of length 2n are presented, one of which generates each string inO(n) worst-case time and requires space for onlyO(1) extra integer variables.

Generating Binary Trees by Transpositions

Combinatorial Gray codes

“loop-free” or “uniformly bounded transition” algorithms, i.e., algorithms which yield linear orders on the sets C(n,k) so that the vectors representing consecutive objects are “close to each other” (combinatorial Gray codes).

Efficient generation of the binary reflected gray code and its applications

Algorithms to generate the n-bit binary reflected Gray code and codewords of fixed weight in that code are presented and applications to the generation of the combinations of n things taken k at a time, the compositions of integers, and the permutations of a multiset are discussed.

Generation of permutations by adjacent transposition

1. RICHARD S. VARGA, Matrix Iterative Analysis, Prentice-Hall, Inc., 1962. 2. E. G. D'YAKONOV, "On a Method of Solving the Poisson Equation," Dokl. Akad. Nauk SSSR 143 (1962), 21-24, the same paper

Loopless Algorithms for Generating Permutations, Combinations, and Other Combinatorial Configurations

The purpose of this work is to find a method for building loopless algorithms for listing combinatorial items, like partitions, permutations, combinations. Gray code, etc. Algorithms for the above