Foundation Data Structures — Overview
Phase 1 — Foundation Data Structures (Days 4-12)
Goal: Build a working knowledge of the seven data structures every coding interview assumes you understand. By the end of this phase you can pick the right structure for a problem in under 30 seconds.
Pre-req: Phase 0 (computational thinking + Big-O + recursion).
What You'll Cover
| # | Module | Days | What you build |
|---|---|---|---|
| 1.1 | Arrays & Strings | 4-5 | HashMap pattern, Kadane's algorithm, two pointers on sorted arrays |
| 1.2 | Prefix Sum | 5 | The "subarray sum = K" insight — prefix-sum + HashMap |
| 1.3 | Matrix | 6 | Spiral traversal, in-place rotation, grid DFS |
| 1.4 | Hash Maps | 6 | Group anagrams (sorted-key trick), longest consecutive sequence |
| 1.5 | Linked Lists | 7 | Reversal, cycle detection (Floyd's), LRU cache (map + doubly-linked list) |
| 1.6 | Stacks & Queues | 8 | Monotonic stack, two-stack queue, basic calculator |
| 1.7 | Trees | 9-10 | Recursive traversals, BFS level order, BST validation, serialize/deserialize |
| 1.8 | Heaps | 11 | K-th largest, top-K frequent, two-heap median, K-way merge |
| 1.9 | Graphs | 12 | Number of islands (DFS flood-fill), course schedule (topo sort), Pacific-Atlantic |
How to Work Each Module
1. Open the module README. Read the "Deep Dive" + "Before You Start".
2. Open problems/XX-name.py. Try BRUTE FORCE first.
3. Stuck > 20 min → read Hint 1, try 10 min.
4. Still stuck → read Hint 2, try 10 min.
5. Still stuck → check solutions/XX-name.py, study the approach,
then re-code it from memory.
6. Fill in TIME / SPACE complexity in the file. Write a NOTES line
on what the trick was.
7. On the site, mark the problem Got it / Review / Struggled.
"Struggled" items resurface on a 1-3-7-14 day spaced schedule.
Why This Phase Matters
Every later phase assumes you can reach for the right data structure without thinking. Phase 2 ("here's a paradigm") only makes sense if you already know which structure to apply it to. Phase 3 (pattern recognition) demands instant identification — and the patterns themselves are named after the structures (heap, two-pointers, monotonic stack).
If you skip a module here, you will pay for it twice: once when the next phase's problems feel impossible, and again when you have to back-fill anyway.
External Resources (Hand-Picked Supplements)
- USFCA Visualizations (David Galles) — interactive animations for every Phase 1 data structure. Step through BST insertion, heap push/pop, hash chaining. Use this when the README's text trace isn't enough.
- freeCodeCamp — Data Structures Easy to Advanced (8h video) — William Fiset's reference course. Skip the parts you've already covered; come back for Heaps, Tries, or Union-Find when you reach Phase 4.
- Tech Interview Handbook — Linked Lists Cheatsheet — a one-page summary of every linked list edge case (cycle, reverse, dummy node) you need to remember.
- NeetCode — Trees Roadmap — visual tree explanations and walkthrough videos for every tree problem in this phase. Free tier covers all the basics.
- Visualgo — Heap — interactive sift-up / sift-down for heap operations. Drop in a sequence to see the structure form.