Recursive counting (CSCI 2824, Spring 2015)Topic covered:
Recursive CountingWe already saw in the previous lecture an example of recursive
counting, when we count the number of ways to distribute The idea behind recursive counting is to set up a recurrence that expresses what you wish to count. This is especially useful when what we wish to count does not neatly fit into any of the categories studied thus far. Example 1Question. How many matches need to be played between Answer
Let us look at it recursively. Let
Can we now express Yes, we can say that with Team Therefore, the answer to the problem is governed by the recurrence relation:
The closed form solution is indeed Example 2Question. What is the number of In other words, what is Answer
Let us write a recurrence. To obtain a permutation of
Step 1 yields Once we have fixed a permutation of the first
Once again, we know by eyeballing the recurrence that Example 3We wish to roll a dice Question. For any integer Answer
Let us get rid of the base cases where
Now for the generic case (i.e., the non-base case where
Therefore, we can now write a recurrence to express the sum:
An alternative approach is to express ![]() ![]() The above is a disjoint union, i.e., the sets whose union gives
![]() |