Recursion Parameters
Current State
Idle
Function Calls
0
Max Stack Depth
0
Recursion Tree Visualization
5
4
3
3
2
2
1
Binary Tree Structure
Visual representation of recursive function calls
Call Hierarchy
Step-by-step execution flow
State Tracking
Monitor recursive state changes
Execution Progress
0/15 nodes visitedCall Stack
Stack Frames
Depth: 5
fib(5)
return 5
n: 5
return: 5
fib(4)
return 3
n: 4
return: 3
fib(3)
executing
n: 3
return: pending
fib(2)
waiting
n: 2
return: pending
fib(1)
waiting
n: 1
return: pending
Stack Overview
Current depth: 5
Max depth: 5
Base cases: 2
Memory Usage
Stack frames: 5
Memory: 2.4KB
Variables: 15
Debug Tools
Current Frame: fib(3)
Line 12: return fib(n-1) + fib(n-2)
Code Display
def fibonacci(n):
# Base cases
if n <= 1:
return n
# Recursive calls
left = fibonacci(n - 1)
right = fibonacci(n - 2)
return left + right
def main():
result = fibonacci(5)
print(f"Fibonacci(5) = {result}")
if __name__ == "__main__":
main()
Line 12
Col 15
Execution Status
Current Line
12
Current Function
fibonacci(3)
Return Value
pending
Function Preview
Language:
Python 3.9
Runtime:
~2.3ms
Memory:
~1.2KB
Debug Console
> fibonacci(5) called
> fibonacci(4) called
> fibonacci(3) called
... pending
Live Preview
Input:
n = 5
Output:
...