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.
Article PDF
Similar content being viewed by others
Avoid common mistakes on your manuscript.
References
Baril, J.-L., Vajnovszki, V.: Gray code for derangements. Disc. App. Math. 140, 207–221 (2004)
Ehrlich, G.: Loopless algorithms for generating permutations, combinations, and other combinatorial configurations. J. Assoc. Comput. Mach. 20, 500–513 (1973)
Heubach, S., Mansour, T.: Combinatorics of Compositions and Words, Discrete Mathematics and its Applications (Boca Raton). CRC, Boca Raton (2009)
Johson, S.M.: Generating of permutations by adjacent transposition. Math. Comput. 17, 282–285 (1963)
Klingsberg, P.: A Gray code for compositions. J Algorithm 3, 41–44 (1982)
Knuth, D.E.: The Art of Computer Programming, vol. 3, (soring and searching). Addison-Wesley, Reading (1973)
Ko, C.W., Ruskey, F.: Generating permutations of a bag by interchanges. Inform. Processing Lett. 41, 263–269 (1992)
Korsh, J.F., LaFollette, P.S.: Loopless array generation of multiset permutations. Technical Report, Department of CIS , PA, USA (2002)
Korsh, J.F., Lipschutz, S.: Generating multiset permutations in constant time. J. Algorithm 25, 321–335 (1997)
Mansour, T., Nassar, G.: Gray codes, loopless algorithm and partitions. J. Math. Model Algor. 7.3, 291–310 (2008)
Roelants van Baronaigien, D., Ruskey, F.: Generating permutations with given ups and downs. Disc. Appl. Math. 36:1, 57–65 (1992)
Ruskey, F., Savage, C.D.: Gray codes for set partitions and restricted growth tails. Aust. J. Combin. 10, 85–96 (1994)
Takaoka, T.: An O(1) time algorithm for generating multiset permutations. Lect. Notes Comp. Sci. 1741, 237–246 (1999)
Trotter, H.F.: Algorithm 115, permutations. Comm. ACM 5, 434–435 (1962)
Vajnovszki, V.: On the loopless generation of binary tree sequences. Inform. Process. Lett. 68, 113–117 (1998)
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)
Vajnovszki, V.: A loopless algorithm for generating the permutations of a multiset. Theoret. Comput. Sci. 307, 415–431 (2003)
Walsh, T.: Loop-free sequencing of bounded integer compositions. J. Combin. Math. and Combin. Comput. 33, 323–345 (2000)
Author information
Authors and Affiliations
Corresponding author
Rights 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
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10852-010-9131-3