ABSTRACT

One of the simplest and most popular problems used to illustrate mutual recursion consists of determining the parity. When applying mutual recursion the first step consists of breaking up a problem into different problems (not simply subproblems). Afterwards, the recursive solutions to these problems are designed by relying on the solutions to their subproblems. Naturally, decomposing the original problem into several different problems requires more work. However, once these problems are defined, the recursive design process is analogous to working with a single method. In other words, this chapter applies problem decomposition and induction as usual. Moreover, the greater complexity of the problems and the nature of the decompositions will accentuate the importance of these concepts. The chapter explains two recursive solutions that solve the counting problem. The first one models the water flow between cities and uses multiple recursion. A second solution considers how the water is discharged at each city, and is based on three mutually recursive functions.