liveBook · Manning

Multiple recursion

As explained in Modern C

Multiple recursion is recursion in which one invocation makes more than one recursive call.

Multiple recursion occurs when one invocation makes more than one recursive call. The Fibonacci function demonstrates the pattern by calling itself with n−1 and n−2. section 7.3

Fibonacci and repeated work

For fib(4), the recursive call tree includes fib(2) twice. Recomputing those identical subproblems makes execution time exponential in n, often ruling out the direct recursive algorithm in practice. A cache stores computed values and changes the running time to linear in n, trading storage for computation. section 7.3

Figure 7.2. Recursive call fib(4)

Use the recursive call tree for fib(4) to trace where multiple recursion duplicates computation. section 7.3

How Modern C covers it

How deep it goes
Explains call duplication and exponential versus linear time, but defers implementation details and concrete timing measurements.
Examples
Uses fib(n), the fib(4) call tree, cached Fibonacci code, and timing exercises.
What it assumes
Assumes familiarity with recursive functions and introduces repeated computation through a concrete Fibonacci implementation.
What you can do after
Evaluate recursive performance and apply caching to eliminate repeated subproblem computation.
How it connects
Connects recursion with caching, algorithms, storage–computation tradeoffs, and computational complexity.

Also explained in

Compare how 2 books explain multiple recursion →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern C. The section links point to the parts of the book it draws on.