Skip to main content

Controls

Recursion Parameters

Current State

Idle

Function Calls

0

Max Stack Depth

0

Recursion Tree Visualization

5
4
3
3
2
2
1
Tree structure

Binary Tree Structure

Visual representation of recursive function calls

Binary tree visualization

Call Hierarchy

Step-by-step execution flow

Minimal tree branches

State Tracking

Monitor recursive state changes

Execution Progress

0/15 nodes visited

Call 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
Code editor

Stack Overview

Current depth: 5
Max depth: 5
Base cases: 2
Working environment

Memory Usage

Stack frames: 5
Memory: 2.4KB
Variables: 15
Development setup

Debug Tools

Current Frame: fib(3)
Line 12: return fib(n-1) + fib(n-2)

Code Display

fibonacci.py
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

Code editor interface
Language: Python 3.9
Runtime: ~2.3ms
Memory: ~1.2KB

Debug Console

Debugging session
> fibonacci(5) called
> fibonacci(4) called
> fibonacci(3) called
... pending

Live Preview

Development environment
Input: n = 5
Output: ...