Algorithms

Recursion tree

The drawing of all the calls of a recursive function that calls itself more than once: each call is a node and its children hang from it.

Example

In Fibonacci, f(5) branches into f(4) and f(3), f(4) into f(3) and f(2)... f(3) shows up twice and f(2), 3 times.

Test yourself: Recursion tree

Iteration and recursion

In recursive Fibonacci, f(n) = f(n − 1) + f(n − 2), what happens with each call?

Lessons that use it

More algorithms terms

All terms →

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.