Recursion explained visually: it's just a stack — base cases, the call stack frame by frame, and the mental model that makes recursion click.
▶ Full written tutorial (free): https://generalistprogrammer.com/tuto...
Recursion explained visually — a function that calls itself, drawn as the call stack it
really is. This is the honest, beginner-friendly explainer, with a live animation of frames
pushing onto the stack as the calls go deeper, then popping back off with their return values.
The one idea to hold onto: recursion is not magic — it is just a stack. Calls pile up on the
way down to the base case, then unwind with the answers on the way back up. Watch factorial of
four build a stack five frames deep, hit the base case, and hand its answers back: 1, 1, 2, 6, 24.
What you will learn:
The two rules every recursion needs: a BASE CASE that stops it, and a RECURSIVE CASE that
moves one step closer to that base case. Miss the base case and the calls never stop — the
stack fills up and your program dies with a stack overflow.
The call stack, drawn live: factorial(4) → factorial(3) → factorial(2) → factorial(1) →
factorial(0). The base case returns 1, then the frames pop and multiply back up to 24.
Where recursion shows up: divide and conquer (merge sort and quicksort, straight from the
Sorting video), tree and graph traversal, nested data like JSON and folders, and the classic
problems — factorial, Fibonacci, and summing a list.
The Fibonacci warning that ties back to Big-O: naive recursive Fibonacci recomputes the same
values in separate branches, so the call tree explodes to O(2^n). The fix (memoization) is teased.
A short, correct, runnable Python factorial: base case n equals 0 returns 1, else n times
factorial of n minus 1.
This is part of the Concepts and Algorithms series, right after Big-O, Binary Search and Sorting.
Next up: Hash Tables — how O(1) lookups actually work, the data structure behind dictionaries and sets.
The full written companion (call stack, base cases and traced examples, in depth):
https://generalistprogrammer.com/tuto...
Want the whole picture? 23 algorithms and data structures, each a clean diagram plus runnable
Python — Algorithms and Data Structures, Visually Explained ($24). Totally optional:
https://generalistprogrammer.gumroad....
— Chapters —
0:00 It's just a stack (factorial 4)
0:53 The visual book ($24)
1:25 The two rules every recursion needs
2:51 The call stack, drawn live
5:20 Where recursion shows up
6:34 The Fibonacci trap (O(2^n))
8:11 The Python code
9:04 Recap — the whole idea
9:57 Hash Tables is next
#recursion #computerscience #callstack
Auf dieser Seite können Sie das Online-Video Recursion, Visually (It's Just a Stack) mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Generalist Programmer 06 Juli 2026 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 13 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!