Code tool

Recursion Tree Visualizer

Choose a built-in function and integer n from 0 to 8. No user code is accepted or executed. The indented tree numbers calls in depth-first entry order and shows each return value.

In-browser processingNo account requiredPrivacy details ↗

Choose a built-in function and integer n from 0 to 8. No user code is accepted or executed. The indented tree numbers calls in depth-first entry order and shows each return value.

A QUICK WALKTHROUGH

How to use this tool

  1. Choose a built-in function and integer n from 0 to 8. No user code is accepted or executed. The indented tree numbers calls in depth-first entry order and shows each return value.
  2. Draw call tree

Which base cases are used?

factorial(0) = factorial(1) = 1; fibonacci(0) = 0 and fibonacci(1) = 1; sum(0) = 0. Fibonacci visits n − 1 before n − 2 without memoization.

GOOD TO KNOW

Common questions

Which base cases are used?

factorial(0) = factorial(1) = 1; fibonacci(0) = 0 and fibonacci(1) = 1; sum(0) = 0. Fibonacci visits n − 1 before n − 2 without memoization.