
326 Design and Analysis of Algorithms
12.5 SOME TYPICAL STATE SPACES
To understand how backtracking works, we must see how objects such as permutations and subsets can be
constructed by defi ning the right state spaces. Examples of several state spaces are described in the next
section.
12.5.1 Constructing All Subsets
To design a suitable state space for representing a collection of combinatorial objects, it is important to know
the number of objects we will need to represent. How many subsets of an n-element set, say the integers
{1, 2, . . . , n}, exist? There are exactly two subsets for n = 1 namely and {1}, four subsets for n = 2, and ...