Simple combinatorial Gray codes constructed by reversing sublists

  • Frank Ruskey
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 762)


We present three related results about simple combinatorial Gray codes constructed recursively by reversing certain sublists. First, we show a bijection between the list of compositions of Knuth and the list of combinations of Eades and McKay. Secondly, we provide a short description of a list of combinations satisfying a more restrictive closeness criteria of Chase. Finally, we develop a new, simply described, Gray code list of the partitions of a set into a fixed number of blocks, as represented by restricted growth sequences. In each case the recursive definition of the list is easily translatable into an algorithm for generating the list in time proportional to the number of elements in the list; i.e., each object is produced in O(1) amortized time by the algorithm.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [BuWi]
    M. Buck and D. Wiedemann, Gray Codes with Restricted Density, Discrete Mathematics, 48 (1984) 163–171.CrossRefGoogle Scholar
  2. [Ch]
    P.J. Chase, Combination Generation and Graylex Ordering, Congressus Numerantium, 69 (1989) 215–242.Google Scholar
  3. [EaHiRe]
    P. Eades, M. Hickey and R. Read, Some Hamilton Paths and a Minimal Change Algorithm, Journal of the ACM, 31 (1984) 19–29.CrossRefGoogle Scholar
  4. [EaMc]
    P. Eades and B. McKay, An Algorithm for Generating Subsets of Fixed Size with a Strong Minimal Change Property, Information Processing Letters, 19 (1984) 131–133.Google Scholar
  5. [Eh]
    G. Ehrlich, Loopless Algorithms for Generating Permutations, Combinations and Other Combinatorial Configurations, Journal of the ACM, 20 (1973) 500–513.CrossRefGoogle Scholar
  6. [FiRe]
    J.A. Fill and E.M. Reingold, Solutions Manual for Combinatorial Algorithms: Theory and Practice, Prentice-Hall, 1977.Google Scholar
  7. [Mi]
    S.C. Milne, Restricted Growth Functions, Rank Row Matchings of Partition Lattices, and q-Stirling Numbers, Advances in Mathematics, 43 (1982) 173–196.CrossRefGoogle Scholar
  8. [ReNiDe]
    E.M. Reingold, J. Nievergelt and N. Deo, Combinatorial Algorithms, Prentice-Hall, Inc., Englewood Cliffs, New Jersey, 1977.Google Scholar
  9. [RuPr]
    F. Ruskey and A. Proskurowski, Generating Binary Trees by Transpositions, J. Algorithms, 11 (1990) 68–84.CrossRefGoogle Scholar
  10. [Sa]
    C.S. Savage, Gray Code Sequences of Partitions, J. Algorithms, 10 (1989) 577–595.CrossRefGoogle Scholar
  11. [Wi]
    Herbert S. Wilf, Combinatorial Algorithms: An Update, SIAM CBMS-55, 1989.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1993

Authors and Affiliations

  • Frank Ruskey
    • 1
  1. 1.Department of Computer ScienceUniversity of VictoriaVictoriaCanada

Personalised recommendations