Fibonacci Numbers Visualizer

Watch how memoization transforms the exponential Fibonacci algorithm into a linear time solution by storing computed values.

Time: O(n) with memo
Space: O(n)
Without memo: O(2^n)
Top-down DP
F(3)F(12)
Fast (300ms)Slow (2000ms)
Progress: Step 1 of 0Phase: start

Fibonacci Sequence

F(0)
?
F(1)
?
F(2)
?
F(3)
?
F(4)
?
F(5)
?
F(6)
?

Call Stack

Call stack is empty

Memoization Table

memo[0]
-
memo[1]
-
memo[2]
-
memo[3]
-
memo[4]
-
memo[5]
-
memo[6]
-

Current Step:

Click Start to begin the Fibonacci visualization

Algorithm Details

With Memoization:O(n)
Without Memoization:O(2^n)
Space:O(n)
Type:Top-down DP

Real-world Applications

  • Financial modeling and compound interest
  • Population growth in biology
  • Computer graphics and spiral patterns
  • Algorithm optimization techniques
  • Nature patterns (flowers, pinecones, shells)

Memoization Benefits

  • Eliminates redundant calculations
  • Transforms exponential to linear time
  • Preserves natural recursive structure
  • Easy to implement and understand
  • Trade-off: Uses O(n) extra space