DSAverse
Recursion
Loading Recursion Visualizer...
Recursion Tree
depth: 1f(n) = f(n-1) + f(n-2)
Initializing Sorting Algorithms...
Sorting
Trees
Graphs
Preparing interactive visualizations...
Recursion
Loading Recursion Visualizer...
Recursion Tree
depth: 1f(n) = f(n-1) + f(n-2)
Master the art of recursive thinking through interactive visualizations. Watch how functions call themselves, build call stacks, and solve complex problems elegantly.
A function that calls itself to solve smaller instances of the same problem — three core ideas make it work.
The terminating condition that stops the recursion. Every recursive function must have at least one base case, otherwise it runs forever.
The function calls itself with modified parameters, reducing the problem toward the base case. Each call is a smaller version of the same problem.
Each recursive call is pushed onto the call stack and resolved in reverse order (LIFO). The stack unwinds as base cases return their values.
Start simple, progress to complex — each visualizer includes step navigation and active recall quizzes.
Calculate factorial using recursive function calls to understand base cases and the call stack building up and unwinding.
Reverse a string character by character using recursive divide & conquer — watch the result build on the unwind phase.
Compute Fibonacci numbers showing explosive naive recursion vs efficient memoization — see the dramatic call count difference.
Solve the classic puzzle using elegant divide & conquer — three recursive steps that together achieve what seems impossible.
Place N queens on an NxN chessboard using backtracking — explore and undo choices systematically until solutions are found.
Navigate a maze using backtracking — explore paths, hit dead ends, retreat, and try again until the goal is found.
Generate all 2ⁿ subsets via binary include/exclude decisions — watch the full decision tree grow level by level.
Generate all n! permutations using swap-based backtracking — fix positions left-to-right and swap back to explore every arrangement.
Solve a 9×9 Sudoku grid using constraint-based backtracking — place digits, hit dead ends, erase, and try the next candidate.