Skip to content
DSA Visualizerpreview

Fibonacci 1: plain recursion

The textbook definition, run as written: the same calls happen again and again.

O(φⁿ) ≈ O(1.6ⁿ) time · O(n) recursion depth space

n5

fib(5) needs fib(4) and fib(3).

Call tree for fib(5): 1 calls so far.
  1. fib(5): needs fib(4) + fib(3)
  • compare
  • swap or write
  • settled

1 / 23

Speed

Space play · ← → step · Home End jump · drag the strip to scrub