The Greedy Gray Code Algorithm

  • Aaron Williams
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8037)


We reinterpret classic Gray codes for binary strings, permutations, combinations, binary trees, and set partitions using a simple greedy algorithm. The algorithm begins with an initial object and an ordered list of operations, and then repeatedly creates a new object by applying the first possible operation to the most recently created object.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Corbett, P.: Rotator graphs: An efficient topology for point-to-point multiprocessor networks. IEEE Trans. on Parallel and Distributed Systems 3, 622–626 (1992)CrossRefGoogle Scholar
  2. 2.
    Duckworth, R., Stedman, F.: Tintinnalogia (1668)Google Scholar
  3. 3.
    Eades, P., McKay, B.: An algorithm for generating subsets of fixed size with a strong minimal change property. Inf. Proc. Letters 19, 131–133 (1984)MathSciNetMATHCrossRefGoogle Scholar
  4. 4.
    Gray, F.: Pulse code communication. U.S. Patent 2,632,058 (1947)Google Scholar
  5. 5.
    Kaye, R.: A Gray code for set partitions. Information Processing Letters 5(6), 171–173 (1976)MathSciNetMATHCrossRefGoogle Scholar
  6. 6.
    Knuth, D.E.: The Art of Computer Programming. Combinatorial Algorithms, Part 1, vol. 4. Addison-Wesley (2010)Google Scholar
  7. 7.
    Lucas, J.M., van Baronaigien, D.R., Ruskey, F.: On rotations and the generation of binary trees. Journal of Algorithms 15, 343–366 (1993)MathSciNetMATHCrossRefGoogle Scholar
  8. 8.
    Martin, M.H.: A problem in arrangements. Bull. Amer. Math. Soc. 40, 859–864 (1934)MathSciNetCrossRefGoogle Scholar
  9. 9.
    Sawada, J., Williams, A.: Greedy pancake flipping. In: Latin-American Algorithms, Graphs and Optimization Symposium, LAGOS 2013 (accepted, 2013)Google Scholar
  10. 10.
    Siegel, J.: Interconnection Networks for Large-Scale Parallel Processing: Theory and Case Studies. McGraw-Hill (1990)Google Scholar
  11. 11.
    Stevens, B., Williams, A.: Hamilton cycles in restricted rotator graphs. In: Iliopoulos, C.S., Smyth, W.F. (eds.) IWOCA 2011. LNCS, vol. 7056, pp. 324–336. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  12. 12.
  13. 13.
    Zaks, S.: A new algorithm for generation of permutations. BIT Numerical Mathematics 24(2), 196–204 (1984)MathSciNetMATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Aaron Williams
    • 1
  1. 1.Department of Mathematics and StatisticsMcGill UniversityCanada

Personalised recommendations