Algorithms
Recursion, the cost of a loop, and the two walls of the degree: searching, sorting and dynamic programming, each one running so you can take it apart.
Start with recursion. Almost everything later in the course, from divide and conquer to tree traversal to dynamic programming, is a variation on what that first lesson shows you.
- Lessons
- 9 of 9 ready
- Anchored to
- CLRS
- Prerequisites
- First-year programming
- Price
- Free, no account
Ready to learn
- 01
Recursion: how a function calls itself
The call tree and the call stack side by side, so you can see a call pause, wait, and pick up exactly where it left off.
8 min·3 predictions·InteractiveStart → - 02
The call stack, and what "stack overflow" means
The same stack from lesson 1, but with a ceiling, and what happens when a program reaches it.
7 min·3 predictions·InteractiveStart → - 03
Big-O: what "grows faster" actually means
Taught as algebra almost everywhere. Here every point is a real operation count, measured by running the code as the input doubles.
9 min·3 predictions·InteractiveStart → - 04
Binary search, and why it is easy to get wrong
Watch the window halve on every comparison, then run the off-by-one version that passes its tests and never finishes.
7 min·3 predictions·InteractiveStart → - 05
Sorting: why O(n log n) beats O(n²)
Three sorts on the same array, with every comparison counted as it happens.
8 min·3 predictions·InteractiveStart → - 06
Divide and conquer
The shape behind merge sort, binary search and half the course: split, solve, combine.
9 min·3 predictions·InteractiveStart → - 07
Graph traversal: BFS and DFS
One algorithm, one container. Swap the queue for a stack and the whole search changes shape.
10 min·3 predictions·InteractiveStart → - 08
Greedy algorithms, and when they are wrong
Take the best option now. Watch the case where that is exactly the mistake.
9 min·3 predictions·InteractiveStart → - 09
Dynamic programming
The second wall of the degree, shown as lesson 1's call tree collapsing once answers start being remembered.
10 min·3 predictions·InteractiveStart →