Skip to main content
Log in

Loop-Free Gray Code Algorithms for the Set of Compositions

  • Published:
Journal of Mathematical Modelling and Algorithms

Abstract

The topic of Gray codes for the set of compositions with non-negative integer parts has been studied by several authors. Klingsberg gave a non-recursive description of a Gray code for this set after the recursive version of Knuth. Recently, Walsh modified Klingsberg’s algorithm to find a Gray code which generates the set of all bounded compositions with non-negative integer parts. In this paper, we present two loopless Gray code algorithms for the set of compositions with positive integer parts.

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., Vajnovszki, V.: Gray code for derangements. Disc. App. Math. 140, 207–221 (2004)

    Article  MATH  MathSciNet  Google Scholar 

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

    MATH  MathSciNet  Google Scholar 

  3. Heubach, S., Mansour, T.: Combinatorics of Compositions and Words, Discrete Mathematics and its Applications (Boca Raton). CRC, Boca Raton (2009)

    Book  Google Scholar 

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

    Article  Google Scholar 

  5. Klingsberg, P.: A Gray code for compositions. J Algorithm 3, 41–44 (1982)

    Article  MATH  MathSciNet  Google Scholar 

  6. Knuth, D.E.: The Art of Computer Programming, vol. 3, (soring and searching). Addison-Wesley, Reading (1973)

    Google Scholar 

  7. Ko, C.W., Ruskey, F.: Generating permutations of a bag by interchanges. Inform. Processing Lett. 41, 263–269 (1992)

    Article  MATH  MathSciNet  Google Scholar 

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

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

    Article  MATH  MathSciNet  Google Scholar 

  10. Mansour, T., Nassar, G.: Gray codes, loopless algorithm and partitions. J. Math. Model Algor. 7.3, 291–310 (2008)

    Article  MathSciNet  Google Scholar 

  11. 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 

  12. 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 

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

    Article  MathSciNet  Google Scholar 

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

    Article  Google Scholar 

  15. Vajnovszki, V.: On the loopless generation of binary tree sequences. Inform. Process. Lett. 68, 113–117 (1998)

    Article  MathSciNet  Google Scholar 

  16. Vajnovszki, V.: A loopless generation of bitstrings without p consecutive ones. In: Combinatorics, computability and logic, pp. 227–240. Springer Ser. Discrete Math. Theor. Comput. Sci. Springer, London (2001)

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

    Article  MATH  MathSciNet  Google Scholar 

  18. Walsh, T.: Loop-free sequencing of bounded integer compositions. J. Combin. Math. and Combin. Comput. 33, 323–345 (2000)

    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. Loop-Free Gray Code Algorithms for the Set of Compositions. J Math Model Algor 9, 343–356 (2010). https://doi.org/10.1007/s10852-010-9131-3

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10852-010-9131-3

Keywords

Navigation