Summary
Two loop-free algorithms, LEX and NEXPAR2, for generating the partitions of a positive integer n, in lexicographic and antilexicographic order, respectively, are investigated, and their structures are shown to be closely related. By utilising a number of combinatorial identities which relate the cardinalities of various classes of partitions, we derive formulae from which operation counts for the two algorithms may be obtained. For large n, corresponding asymptotic formulae are also obtained. A number of modifications and refinements of the two algorithms are discussed, and the relative performance of the algorithms resulting, and also the original algorithms, is analysed for both the non-asymptotic and the asymptotic cases.
Similar content being viewed by others
References
Andrews, G.E.: The theory of partitions. Reading, Massachusetts: Addison-Wesley 1976
Berge, C.: Principles of combinatorics. New York: Academic Press 1971
Brylawski, T.: The lattice of integer partitions. Discrete Math. 6, 201–219 (1973)
Ehrlich, G.: Loopless algorithms for generating permutations, combinations, and other combinatorial configurations. J. Assoc. Comput. Mach. 20, 500–513 (1973)
Fenner, T.I., Loizou, G.: A binary tree representation and related algorithms for generating integer partitions. Computer J. 23, 332–337 (1980)
Hardy, G.H., Ramanujan, S.: Asymptotic formulae in combinatory analysis. Proc. London Math. Soc. 17, 75–115 (1918)
McKay, J.K.S.: Partitions in natural order, Algorithm 371. Comm. ACM 13, 52 (1970)
Nijenhuis, A., Wilf, H.S.: Combinatorial algorithms. New York: Academic Press 1975
Page, E.S., Wilson, L.B.: An introduction to computational combinatorics. Cambridge: Camridge University Press 1979
Reingold, E.M., Nievergelt, J., Deo, N.: Combinatorial algorithms: Theory and practice. Englewood Cliffs, New Jersey: Prentice-Hall 1977
Riha, W., James, K.R.: Efficient algorithms for doubly and multiply restricted partitions, Algorithm 29. Computing 16, 163–168 (1976)
Stockmal, F.: Generation of partitions in part-count form, Algorithm 95. Comm. ACM 5, 344 (1962)
Wells, M.B.: Elements of combinatorial computing. Oxford: Pergamon Press 1971
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Fenner, T.I., Loizou, G. An analysis of two related loop-free algorithms for generating integer partitions. Acta Informatica 16, 237–252 (1981). https://doi.org/10.1007/BF00261261
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00261261