Skip to main content
Log in

Gray Codes, Loopless Algorithm and Partitions

  • Published:
Journal of Mathematical Modelling and Algorithms

Abstract

The generation of efficient Gray codes and combinatorial algorithms that list all the members of a combinatorial object has received a lot of attention in the last few years. Knuth gave a code for the set of all partitions of [n] = {1,2,...,n}. Ruskey presented a modified version of Knuth’s algorithm with distance 2. Ehrlich introduced a looplees algorithm for the set of the partitions of [n]; Ruskey and Savage generalized Ehrlich’s results and introduced two Gray codes for the set of partitions of [n]. In this paper, we give another combinatorial Gray code for the set of the partitions of [n] which differs from the aforementioned Gray codes. Also, we construct a different loopless algorithm for generating the set of all partitions of [n] which gives a constant time between successive partitions in the construction process.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Baril, J.-L.: Gray code for permutations with a fixed number of cycles. Disc. Math. 307(13), 1559–1571 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  2. Baril, J.-L., Vajnovszki, V.: Gray code for derangements. Discrete Appl. Math. 140, 207–221 (2004)

    Article  MATH  MathSciNet  Google Scholar 

  3. Ehrlich, G.: Loopless algorithms for generating permutations, combinations, and other combinatorial configurations. J. Assoc. Comput. Mach. 20, 500–513 (1973)

    MATH  MathSciNet  Google Scholar 

  4. Johson, S.M.: Generating of permutations by adjacent transposition. Math. Comput. 17, 282–285 (1963)

    Article  Google Scholar 

  5. Klazar, M.: On abab-free and abba-free set partitions. Eur. J. Comb. 17, 53–68 (1996)

    Article  MATH  MathSciNet  Google Scholar 

  6. Ko, C.W., Ruskey, F.: Generating permutations of a bag by interchanges. Inf. Process. Lett. 41, 263–269 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  7. Korsh, J.F., LaFollette, P.S.: Loopless array generation of multiset permutations. Technical Report, Department of CIS, PA, USA (2002)

  8. Korsh, J.F., Lipschutz, S.: Generating multiset permutations in constant time. J. Algorithms 25, 321–335 (1997)

    Article  MATH  MathSciNet  Google Scholar 

  9. Roelants van Baronaigien, D., Ruskey, F.: Generating permutations with given ups and downs. Disc. Appl. Math. 36(1), 57–65 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  10. Ruskey, F.: Combinatorial Generation. See http://www.cs.sunysb.edu/~algorith/implement/ruskey/implement.shtml

  11. Ruskey, F., Savage, C.D.: Gray codes for set partitions and restricted growth tails. Aust. J. Combin. 10, 85–96 (1994)

    MATH  MathSciNet  Google Scholar 

  12. Stanley, R.: Enumerative Combinatorics, vol. 1. Cambridge University Press, Cambridge, UK (1997)

    MATH  Google Scholar 

  13. Stanton, D., White, D.: Constructive Combinatorics. Springer-Verlag, Berlin Heidelberg New York (1986)

    MATH  Google Scholar 

  14. Takaoka, T., An O(1) time algorithm for generating multiset permutations. Lect. Notes Comput. Sci. 1741, 237–246 (1999)

    Article  MathSciNet  Google Scholar 

  15. Trotter, H.F.: Algorithm 115, permutations. Commun. ACM 5, 434–435 (1962)

    Article  Google Scholar 

  16. Vajnovszki, V.: A loopless algorithm for generating the permutations of a multiset. Theor. Comput. Sci. 307, 415–431 (2003)

    Article  MATH  MathSciNet  Google Scholar 

  17. Walsh, T.: Gray codes for involutions. J. Combin. Math. Combin. Comput. 36, 95–118 (2001)

    MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Toufik Mansour.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Mansour, T., Nassar, G. Gray Codes, Loopless Algorithm and Partitions. J Math Model Algor 7, 291–310 (2008). https://doi.org/10.1007/s10852-008-9086-9

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10852-008-9086-9

Keywords

Mathematics Subject Classifications (2000)

Navigation