COSC 2306: Data Programming

Interactive Recursion

Master the fundamental concepts of recursive functions through step-by-step call stack visualizations and execution tree tracing.

Factorial

The classic linear recursion example. Witness how the call stack "winds" up and "unwinds" to calculate n!.

Launch Visualizer

Fibonacci

Explore branching recursion through a dynamic execution tree. Analyze redundant calls and the exponential complexity of O(2ⁿ).

Launch Visualizer

Power of 2

Compare recursive and iterative patterns side-by-side. Understand how loops and function calls differ in memory and execution flow.

Launch Visualizer

Largest in List

Trace recursion on lists. See how the list is shortened at each step and elements are compared during the "unwind" phase.

Launch Visualizer

Essential Recursion

Rule 01

The Base Case

The most important part! This is the stopping condition that prevents infinite recursion. Usually the smallest solvable version of the problem.

Rule 02

The Recursive Step

Where the function calls itself, but with a parameter that is modified to move "closer" to the base case.