RESEARCH AND SOFTWARE IMPLEMENTATION OF COMBINATORIAL OBJECT GENERATION ALGORITHMS
Main Article Content
Abstract
Introduction. Combinatorics is one of the fundamental branches of discrete
mathematics concerned with counting and constructing objects that satisfy given properties.
Combinatorial objects – permutations, placements, and combinations – are widely used in probability
theory, statistics, cryptography, and algorithm design. The generation of all possible configurations of
such objects belongs to the class of NP problems, where the number of configurations grows
factorially or exponentially with input size.
Purpose. The aim of this work is to systematize the mathematical foundations of the main
combinatorial objects, describe and compare algorithms for their generation implemented in Python
using recursive and iterative approaches, and develop a software product with a graphical interface
for visual demonstration.
Results. The paper presents mathematical formulas for counting all six types of combinatorial
objects (permutations, placements, and combinations, with and without repetition). Recursive and
iterative generation algorithms are described and implemented in Python. The use of generators and
the yield keyword is shown to provide an efficient approach to streaming generation of large sets of
combinatorial objects. The recursive approach is more readable and natural but less memoryefficient; iterative algorithms with generators are preferable for practical use. A graphical application
built with PyQt5 demonstrates the algorithms' results interactively.
Conclusion. The generation of combinatorial objects is inherently NP in nature: the number of
objects grows unmanageably fast even for moderate input values. Both recursive and iterative
algorithms yield correct results; the choice between them depends on the specific requirements of
readability, memory efficiency, and the size of input data. The developed software product can be used
as an educational tool in mathematics and computer science classes.
Article Details
References
Cormen T.H., Leiserson C.E., Rivest R.L., Stein C. (2022) Introduction to Algorithms (4th ed.).
Cambridge, MA: The MIT Press.
PyQt5 5.15.10. Available at: https://pypi.org/project/PyQt5/
Python Programming Language. Available at: https://www.python.org/
Real Python Tutorials. Available at: https://realpython.com/
Schmidt W.M. (1991) Diophantine Approximations and Diophantine Equations. Berlin: SpringerVerlag.
Vyhondner I.V., Bilousova T.P., Liakhovych T.P. (2019) Probability Theory and Mathematical
Statistics: a textbook. Kherson: Helvetyka. [in Ukrainian]
Havrylkiv V.M. (2023) Formal Languages and Algorithmic Models. Ivano-Frankivsk: Holinei. [in
Ukrainian]
Zaitsev Ye. (2013) Probability Theory and Mathematical Statistics. Kyiv: Alerta. [in Ukrainian]
Kostarchuk V. M. (1986) Graph Theory and Its Applications / V. M. Kostarchuk. – Kyiv :
Vyshcha Shkola. [in Ukrainian]
Martyniuk O.M., Popina S.Yu. (2003) Elements of Combinatorics and the Classical Definition of
Probability. Ternopil. [in Ukrainian]
Diestel R. (2017) Graph Theory. Hamburg : Springer.
Python Tutorial (Ukrainian). Available at: https://docs.python.org/uk/3/tutorial/index.html