chapter six
6 Combinatorial algorithms
This chapter covers
- generating the Cartesian product of two, three, or arbitrarily many sequences
- generating all the permutations (reorderings) of a sequence
- generating all the combinations (subsequences) of a sequence
- the deep connection between these three combinatoric operations and ways to decomposing integers into sums
Combinatorics is today a broad field of mathematics, covering everything from graph theory to optimization theory, but the common thread running through it all is that we are interested in algorithms for solving problems involving a finite number of discrete elements, such as a sequence of n integers. In this chapter we’ll cover three of the basic combinatoric operations on sequences.