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.
Article PDF
Similar content being viewed by others
Avoid common mistakes on your manuscript.
References
Baril, J.-L.: Gray code for permutations with a fixed number of cycles. Disc. Math. 307(13), 1559–1571 (2007)
Baril, J.-L., Vajnovszki, V.: Gray code for derangements. Discrete Appl. 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)
Johson, S.M.: Generating of permutations by adjacent transposition. Math. Comput. 17, 282–285 (1963)
Klazar, M.: On abab-free and abba-free set partitions. Eur. J. Comb. 17, 53–68 (1996)
Ko, C.W., Ruskey, F.: Generating permutations of a bag by interchanges. Inf. Process. 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. Algorithms 25, 321–335 (1997)
Roelants van Baronaigien, D., Ruskey, F.: Generating permutations with given ups and downs. Disc. Appl. Math. 36(1), 57–65 (1992)
Ruskey, F.: Combinatorial Generation. See http://www.cs.sunysb.edu/~algorith/implement/ruskey/implement.shtml
Ruskey, F., Savage, C.D.: Gray codes for set partitions and restricted growth tails. Aust. J. Combin. 10, 85–96 (1994)
Stanley, R.: Enumerative Combinatorics, vol. 1. Cambridge University Press, Cambridge, UK (1997)
Stanton, D., White, D.: Constructive Combinatorics. Springer-Verlag, Berlin Heidelberg New York (1986)
Takaoka, T., An O(1) time algorithm for generating multiset permutations. Lect. Notes Comput. Sci. 1741, 237–246 (1999)
Trotter, H.F.: Algorithm 115, permutations. Commun. ACM 5, 434–435 (1962)
Vajnovszki, V.: A loopless algorithm for generating the permutations of a multiset. Theor. Comput. Sci. 307, 415–431 (2003)
Walsh, T.: Gray codes for involutions. J. Combin. Math. Combin. Comput. 36, 95–118 (2001)
Author information
Authors and Affiliations
Corresponding author
Rights 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
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10852-008-9086-9