16D. Summary

The key to understanding recursion is to assume that recursive calls work according to the function contract. Hand simulation of a recursive function avoids doing hand simulation of recursive calls.

You need to be sure that your function does not go into an infinite recursion. If f (n) calls f (x), where the parameter of f  is a nonnegative integer, then be sure that x < n. If f  has more than one parameter, make sure that a similar rule is true for one of the parameters.

There are variations on what decreases in recursive calls. For example, a recursive definition of f (a, b) might call f (a+1, b) when a < b. Since b − (a+1) is smaller than ba, it is that difference that decreases. If a parameter is a string, each recursive call can be on a shorter string.