Deep Learn — CS Fundamentals
Goal
Build correct mental models — understand the WHY behind every design decision.
Phase 0 — Anchor Implementation
For every CS fundamental, you will implement a simplified version from scratch. This is non-negotiable.
| Topic | Anchor implementation |
|---|---|
| Hash table | Build one in Python: handle collisions with chaining |
| TCP/IP | Build a simple TCP-like protocol over UDP |
| B-tree | Implement insert + search from scratch |
| OS scheduling | Simulate round-robin and priority scheduling |
| Consensus | Implement a simplified Raft leader election |
| Compiler basics | Build a calculator with tokeniser + parser |
Phase 1 — Historical Context (10 min)
Before studying HOW it works, study WHY it was invented:
- What problem existed before this?
- What was the previous solution, and why was it inadequate?
- What constraints shaped the design? (hardware limits, network conditions, etc.)
Understanding constraints is 80% of understanding the design.
Phase 2 — Mental Model Construction
- Draw a diagram before reading. Sketch your guess of how it works.
- Read the actual mechanism. Compare with your diagram.
- Redraw the corrected version from memory.
Key questions to answer:
- What are the components and their responsibilities?
- How do they communicate / coordinate?
- What invariants must always hold?
- What happens when something fails?
✅ Gate: Can you redraw the architecture from memory?
Phase 3 — Implement the Simplified Version
- Build the anchor implementation from Phase 0.
- Start with the happy path — get it working for basic cases.
- Add failure modes one by one:
- What happens under load?
- What happens on network partition / disk failure / race condition?
- Compare your implementation decisions with the real one.
✅ Gate: Working implementation exists, failure modes are understood.
Phase 4 — Tradeoffs & Alternatives
- Study 2 alternative approaches to the same problem.
- Fill in this table:
| Approach | Strength | Weakness | When to use |
|---|---|---|---|
| This | ... | ... | ... |
| Alt 1 | ... | ... | ... |
| Alt 2 | ... | ... | ... |
- Find a real-world system (Linux kernel, PostgreSQL, nginx) that uses this concept.
- Read the relevant section of its source code or docs.
✅ Gate: Feynman test — explain to a non-CS friend in plain English.
Active Recall Prompts
- Draw the architecture from memory right now.
- What are the 3 hardest problems this design has to solve?
- What would break first under high load?
- Why didn't they just use [simpler solution]?
Examples
teach me how TCP/IP really works under the hoodI want to deeply understand how a hash table works, help me implement oneexplain B-trees deeply and why databases use them over other structures