Recursion Types Visualizer

Explore different types of recursion with interactive tree visualization

Recursion Type

Recursion Tree

Recursion tree will appear here. Click "Start" to begin.
0
Max Depth
0
Total Calls
0
Active
Complete

Controls

Factorial

1function factorial(n) {
2  if (n <= 1) return 1;
3  return n * factorial(n - 1);
4}
Step 1 of 2

Check base case: if n ≤ 1

About This Example

Classic factorial calculation

Characteristics

Direct Recursion
A function calls itself directly
• Function calls itself
• Simple and intuitive
• Stack grows with each call

Legend

Active (currently executing)
Returning (has result)
Completed