DAY 30 / 30 · WEEK 4

Final Review & Cheat Sheet

Goal of the day

Concept

There's no new algorithm today. Days 1 through 29 built roughly 30 real, working implementations from scratch — every one of them node-verified before it ever reached a page, every diagram checked for the same handful of recurring bugs, every animation traced against the actual code it's demonstrating. That's the entire point of this course: not reading about algorithms, but building and watching each one actually run. Day 30 is compaction, not addition — turning a month of that work into a single page you can review in ten minutes the morning of a real interview.

The two deliverables below are meant to be used differently. The cheat sheet is a lookup table — skim it now, then come back to it later whenever a specific complexity or trigger phrase needs confirming. The interview-day checklist is meant to be read once, close to the actual day, since it's about logistics and mindset rather than material you need to memorize.

Diagram: the 30-day arc

Four weeks, one arc Days 1-7 Days 8-14 Days 15-21 Days 22-30 Week 1 — JS foundations + core patterns Week 2 — Sorting, searching, recursion Week 3 — Core data structures Week 4 — Advanced topics + interview simulation Every block built on the ones before it — quickselect (14) needed sorting AND binary search; today's cheat sheet is the whole arc on one page.

Interactive: your progress

Loading your progress…

The complete cheat sheet — every algorithm, every complexity

All 30 days, one table. "Trigger" is the one-line signal from Day 28's recognition process — the phrase or shape that tells you to reach for this specific row.

AlgorithmDayTimeSpaceTrigger
Two Pointer4O(n)O(1)Converge from both ends of a sorted/orderable structure
Sliding Window5O(n)O(1) – O(k)Contiguous range with a grow/shrink validity condition
Hash Map / Set frequency6O(n)O(n)Need O(1) lookup/count; order doesn't matter
Bubble / Insertion Sort8 / 8cO(n) best, O(n²) worstO(1)Small or nearly-sorted input, simplicity over speed
Selection Sort8bO(n²) alwaysO(1)Minimize the number of swaps specifically
Recursion (naive)9often O(2ⁿ)O(depth)Problem splits into smaller identical subproblems
Merge Sort10O(n log n) alwaysO(n)Guaranteed worst-case time AND stability required
Quick Sort11O(n log n) avg, O(n²) worstO(log n)In-place sorting, average-case speed matters most
Binary Search — exact match12O(log n)O(1)Sorted array, looking for an exact value
Binary Search — boundary / search on answer13O(log n) or O(n log m)O(1)First/last occurrence, or a monotonic predicate
Quickselect14O(n) avg, O(n²) worstO(1) extraKth largest/smallest without fully sorting
Linked list insert/delete at known node15 / 16O(1)O(1)O(1) insert/delete needed, no array shifting allowed
Fast/Slow Pointers16O(n)O(1)Find the middle, or detect a cycle, in one pass
Stack (Valid Parens / Min Stack)17O(1) per opO(n)Most-recent-first (LIFO) matching or undo
Queue / Deque (Sliding Window Max)18O(n) amortizedO(k)FIFO order, or a monotonic window
BFS (tree)19O(n)O(n)Level-order traversal
DFS (tree)19O(n)O(h)Full-depth traversal, or backtracking
BST search / insert20O(h)O(1) iterativeSorted-order search/insert, or free sorted traversal
Iterative inorder BST validate21O(n)O(h)Validate sorted order without recursive min/max bounds
Heap insert / extract22O(log n)O(n)Repeated min/max needed from a changing set
Graph BFS / DFS23O(V + E)O(V)Nodes connect arbitrarily, not a strict hierarchy
BFS shortest path (unweighted)24O(V + E)O(V)Fewest hops/edges between two nodes
Topological Sort (Kahn's)24O(V + E)O(V)Order with dependencies; detect a cycle as a side effect
DP — sum recurrence (Fibonacci / Climbing Stairs)25O(n)O(1) rollingCount ways, overlapping subproblems, no decision involved
DP — max-of-choices (House Robber)26O(n)O(1) rollingOptimization with a constraint, 2 mutually exclusive options
DP — unbounded (Coin Change)26O(amount × options)O(amount)Reusable "coins," min/max over every option at each cell
Greedy (interval scheduling)27O(n log n)O(1) – O(n)Provably safe locally-optimal choice; sort first
Expand Around Center (palindrome)29O(n²)O(1)Longest palindromic substring
2D DP (Longest Common Subsequence)29O(m × n)O(m × n)Compare 2 sequences, subsequence not substring
Multi-source BFS29O(rows × cols)O(rows × cols)Distance from several simultaneous starting points

Interview-day checklist

Not algorithms — logistics and mindset, the things that are easy to forget under pre-interview nerves.

The night before

The morning of

During each problem

After each problem

Interview corner — what comes after Day 30

Quiz — final check

1. In one sentence, what actually separates sliding window from two-pointer?

2. Why does merge sort guarantee O(n log n) in the worst case, while quick sort can degrade to O(n²)?

3. Why does an iterative inorder walk with a plain stack correctly validate a BST, with no min/max bounds tracked anywhere?

4. What single property has to hold before a greedy algorithm is safe to trust?

5. In Kahn's algorithm, what does it mean when the final order comes up shorter than the total number of nodes?