← Back to Games

🌳 Recursion Complexity Visualizer

See recursion trees expand and understand their complexity!

🌲 Recursion Tree
0
Total Calls
0
Tree Depth
0
Input N
-
Time Complexity
📜 Call Stack
📚 Execution Order

📚 Understanding Recursion Complexity

The complexity of a recursive function depends on:

  • T(n) = T(n-1) + O(1): Linear recursion → O(N)
  • T(n) = T(n/2) + O(1): Halving recursion → O(log N)
  • T(n) = 2T(n/2) + O(1): Binary tree → O(N)
  • T(n) = 2T(n-1) + O(1): Exponential → O(2^N)
  • T(n) = 2T(n/2) + O(N): Merge sort pattern → O(N log N)
⚙️ Recurrence Relation
T(n-1) + 1
O(N)
T(n/2) + 1
O(log N)
2T(n/2) + 1
O(N)
2T(n-1) + 1
O(2^N)
🎯 Predict the Complexity!

Before building, what's the complexity?

O(N)
O(log N)
O(N log N)
O(2^N)