◇ dsa-prep/readme.md
DSA Prep — Comprehensive Reference
Complete reference for Data Structures and Algorithms aligned with the Neetcode 150 weekly schedule. Each file is a deep dive with intuition, ASCII diagrams, Python (and C++ where useful) implementations, complexity a…
~4 min read·updated 5/29/2026
DSA Prep — Comprehensive Reference
Complete reference for Data Structures and Algorithms aligned with the Neetcode 150 weekly schedule. Each file is a deep dive with intuition, ASCII diagrams, Python (and C++ where useful) implementations, complexity analysis, and curated practice problems.
How to use this folder: open the file matching the current Neetcode week before you attempt the problems. Read the Concept and Pattern sections. Try problems first; come back to Pitfalls and Practice when stuck.
Index
| # | File | Neetcode Week | What You'll Learn |
|---|---|---|---|
| 0 | 00-foundations.md | Pre-week | Big O, complexity, Python/C++ idioms, math you'll need |
| 1 | 01-arrays-hashing.md | Week 1 | Arrays, strings, hashmaps, hashsets, frequency counting |
| 2 | 02-two-pointers.md | Week 2a | Opposing/same-direction pointers, partitioning |
| 3 | 03-sliding-window.md | Week 2b | Fixed/variable windows, expand-shrink template |
| 4 | 04-stack.md | Week 3 | LIFO patterns, monotonic stack, parsing |
| 5 | 05-binary-search.md | Week 4 | Classic + variants, search-on-answer pattern |
| 6 | 06-linked-list.md | Week 5 | Pointers, cycles, reversal, dummy heads, LRU |
| 7 | 07-trees.md | Week 6-7a | Traversals, recursion, BST, BFS, level-order |
| 8 | 08-tries.md | Week 7b | Prefix tree, autocomplete, word search |
| 9 | 09-heaps.md | Week 8a | Priority queue, top-K, two-heaps for medians |
| 10 | 10-backtracking.md | Week 8b | Recursion + undo, subsets, permutations, N-Queens |
| 11 | 11-graphs.md | Week 9 | BFS/DFS, islands, topological sort, cycles |
| 12 | 12-advanced-graphs.md | Week 10 | Dijkstra, Bellman-Ford, Union-Find, MST |
| 13 | 13-dp-1d.md | Week 11 | 1D DP — top-down/bottom-up, decision trees |
| 14 | 14-dp-2d.md | Week 12a | 2D DP — grids, knapsack, LCS, edit distance |
| 15 | 15-greedy-intervals.md | Week 12b | Greedy proofs, interval scheduling/merging |
| 16 | 16-bit-manipulation.md | Week 12c | Bitwise ops, XOR tricks, bitmask DP |
| 17 | 17-patterns-cheatsheet.md | All weeks | One-page lookup: "when do I use which pattern?" |
| 18 | 18-interview-strategy.md | Phase 3 | UMPIRE, communication, Google-specific tactics |
How a problem unfolds (UMPIRE method)
Every interview problem should follow this sequence. The whole point of pattern recognition is to get from step U to step P quickly.
U — Understand ── repeat the problem in your words; ask edge cases
M — Match ── which pattern is this? (this folder is your dictionary)
P — Plan ── pseudo-code, complexity estimate
I — Implement ── write code in Python/C++
R — Review ── trace through example, find off-by-ones
E — Evaluate ── analyze actual O(n), discuss tradeoffs
See 18-interview-strategy.md for how to apply this in 45 minutes.
Pattern → Trigger Quick Lookup
If you can read a problem and match it to a pattern in <60 seconds, you're 80% of the way to solved. Memorize these triggers:
| Trigger phrase / shape | Pattern | File |
|---|---|---|
| "find pair / triplet that sums to X" in sorted array | Two pointers | 02 |
| "longest/shortest substring with property" | Sliding window | 03 |
| "next greater / previous smaller / span" | Monotonic stack | 04 |
| "search in sorted / find boundary" | Binary search | 05 |
| "minimize max / maximize min" feasibility check | Binary search on answer | 05 |
| "cycle in linked list / find middle" | Fast & slow pointers | 06 |
| "all paths / all combinations / all permutations" | Backtracking | 10 |
| "shortest path in unweighted graph / grid" | BFS | 11 |
| "shortest path with weights ≥ 0" | Dijkstra | 12 |
| "shortest path, weights can be negative" | Bellman-Ford | 12 |
| "course schedule / dependency order" | Topological sort | 11 |
| "groups / connected components / merge sets" | Union-Find | 12 |
| "K most/least frequent / closest" | Heap (top-K) | 09 |
| "running median / two halves" | Two heaps | 09 |
| "decisions with overlapping subproblems" | DP | 13/14 |
| "merge / overlap / schedule intervals" | Sort + sweep | 15 |
| "all subsets containing X / no duplicates" | Bitmask | 16 |
Full table with examples in 17-patterns-cheatsheet.md.
External resources used throughout
These are referenced across files. Bookmark them.
- NeetCode YouTube — https://www.youtube.com/c/NeetCode (best free explainer videos)
- NeetCode Roadmap — https://neetcode.io/roadmap (visual dependency graph of patterns)
- VisuAlgo — https://visualgo.net (animated DSA visualizations, irreplaceable for trees/graphs)
- CP-Algorithms — https://cp-algorithms.com (canonical reference for harder algorithms)
- LeetCode — https://leetcode.com (the practice ground)
- Python heapq docs — https://docs.python.org/3/library/heapq.html
- C++ STL reference — https://en.cppreference.com/w/cpp/container
Notation used in these notes
| Symbol | Meaning |
|---|---|
n | input size (length of array, number of nodes, etc.) |
m | second dimension (cols of grid, length of pattern, etc.) |
V, E | vertices, edges of a graph |
k | a parameter ("top K", "K-sorted lists") |
O(...) | upper bound on time |
Θ(...) | tight bound (rare in interviews; usually O is enough) |
Ω(...) | lower bound (theoretical floor) |
* | amortized (e.g., dynamic array append is O(1)*) |
Self-assessment after each topic
After finishing a file's problems, ask yourself:
- Can I write the template for this pattern from memory in 5 minutes?
- Can I name 3 problem variants and what they change?
- Can I state the complexity and prove it (not just memorize)?
- Can I explain when this pattern is wrong — what would force me elsewhere?
If "no" to any: re-read the file and re-do the failed problem in 3 days.
// 1 view