🏠
Guest Not signed in

Recursion: relate the big problem to a smaller copy

Solve a problem of size $n$ by relating it to size $n-1$. The hard part is finding the recurrence, never solving it.

Method · Recursion
Intro
A recursive fractal tree growing branch by branch, splitting at each iteration
Rafael Ruggiero (User:Azulejoazul) β€” https://commons.wikimedia.org/wiki/File:Fractal_tree.gif · CC BY-SA 4.0 · Wikimedia Commons

Recursion solves a problem by relating $f(n)$ to smaller instances $f(n-1)$, $f(n-2)$, and so on. Find the boundary (the smallest case you can answer directly), express the recurrence (relate big to small), then walk up. The same three-step skeleton powers Fibonacci-style counting, Tower of Hanoi, expected values via first-step analysis, and most of the dynamic-programming half of FAANG interviews.

βœ“ Intro Β· expand
Independent · Legal