Foundations Roadmap
Algorithms, C++ (PPP3), Discrete Math (Epp), and Neetcode
No fixed calendar. The sequence matters, the clock doesn't — depth over schedule.
A note on the C++ track: reading leads with PPP3 (Stroustrup's Programming: Principles and Practice, 3rd ed.) — it's built as a real introduction to programming, not just C++ syntax, and covers the early foundational material in more depth than Tour of C++ does. PPP3 is about half the size of PPP2 because concurrency, numerics, and some advanced-template material were pushed to free web-only chapters rather than the printed book. Where that leaves a gap — generic programming/concepts, concurrency, numerics — Tour of C++ stays in as a secondary reference, flagged where it appears.
PHASE 0: THE LAUNCHPAD
Building the Foundation
Reading
- Discrete Math (Epp): Ch 2.1–2.3 The Logic of Compound Statements; Ch 3.1–3.3 The Logic of Quantified Statements; Ch 4.1–4.4 Elementary Number Theory and Methods of Proof; Ch 5.1–5.3 Sequences, Mathematical Induction, and Recursion
- Algorithms Syllabus: none yet — pure math and C++ warm-up
- C++ (PPP3): Ch 1 Hello, World!; Ch 2 Objects, Types, and Values; Ch 3 Computation; Ch 4 Errors!
Micro-Projects
-
Prime Number Tester with Proof — checks if
a number is prime; add a
--verifyflag that prints the loop invariant at each step; include the inductive proof as a comment. C++ features: functions, command-line args, bool, loops. -
Summation Calculator — compute
1+2+3+...+nusing a loop and closed-formn*(n+1)/2; prove by induction they're equal (print proof as comment); compare runtimes withstd::chrono. C++ features: functions,long long,std::chrono.
Neetcode
None yet — focus on math and C++ basics.
PHASE 1: FOUNDATIONS OF ALGORITHM ANALYSIS
Reading
- Algorithms Syllabus: Ch 1 The Role of Algorithms and Data Structures (Levitin 1.1–1.3 + Morin 1.1); Ch 2 Mathematical Preliminaries (Morin 1.3 + Levitin App. A); Ch 3 Growth of Functions and Asymptotic Notation (Levitin 2.1–2.2 + Morin 1.3.3); Ch 4 Analyzing Algorithms: Recursive and Nonrecursive Cases (Levitin 2.3–2.6); Ch 5 The Model of Computation (Morin 1.4–1.5)
- Discrete Math (Epp): Ch 5.4–5.6 Strong Induction and Recursive Definitions; Ch 9.1–9.3 Counting and Probability (basic counting, permutations, combinations); Ch 11.1–11.3 Analysis of Algorithm Efficiency (order notation, worst-case analysis)
- C++ (PPP3): Ch 5 Writing a Program; Ch 6 Completing a Program; Ch 7 Technicalities: Functions, etc.
Micro-Projects
-
Big-O Visualizer — generate arrays of size
n = 10, 100, 1000, 10000; run three functions of O(1), O(n),
O(n²); print runtime for each and verify growth matches
theory. C++ features:
std::vector,std::chrono, pass-by-reference vs value. -
Recursion vs Iteration Benchmark —
implement Fibonacci using recursion, iterative DP, and
closed-form; compare runtimes and stack usage.
C++ features: recursive functions,
std::function,std::chrono.
Neetcode — Arrays & Hashing (warm-up)
- Contains Duplicate — analyze O(n) time, O(n) space
- Valid Anagram — analyze O(n) time, O(1) space
- Two Sum — analyze O(n) time with hash map
PHASE 2: ELEMENTARY DATA STRUCTURES
Reading
- Algorithms Syllabus: Ch 6 Array-Based Lists: Stacks, Queues, Deques (Morin ch. 2); Ch 7 Linked Lists (Morin ch. 3); Ch 8 Hashing and Hash Tables (Morin ch. 5 + Levitin 7.3); Ch 9 Skiplists (Morin ch. 4)
- Discrete Math (Epp): Ch 9.4–9.6 Permutations with repetition, combinations with repetition, probability; Ch 7.1–7.3 Functions (definitions, one-to-one, onto, inverse); Ch 10.1–10.2 Graphs (basic definitions, paths, cycles)
- C++ (PPP3): Ch 8 Technicalities: Classes, etc.; Ch 15 Vector and Free Store; Ch 18 Templates and Exceptions
Micro-Projects
-
DIY Vector — implement
Vector<T>with dynamic resizing (double capacity when full),push_back(),pop_back(),size(),capacity(),operator[], proper copy constructor, assignment operator, move semantics. C++ features: templates, RAII, copy/move, destructors. -
Stack-Based RPN Calculator — postfix (RPN)
calculator using your own
Stack<T>; support+ - * / ^; handle errors (division by zero, invalid input). C++ features: templates, exception handling,std::stringparsing. -
Word Frequency Counter — read a text file,
split into words, count frequencies; use
std::unordered_map, then implement your ownHashMap<K,V>; compare performance againststd::unordered_map. C++ features:std::ifstream,std::string,std::hash, custom hash.
Neetcode
Linked List: Reverse Linked List · Merge Two Sorted Lists · Linked List Cycle · Remove Nth Node From End of List
Stack: Valid Parentheses · Min Stack · Evaluate Reverse Polish Notation
Hash Map: Contains Duplicate II
PHASE 3: SORTING & DESIGN PARADIGMS
Reading
- Algorithms Syllabus: Ch 10 Divide-and-Conquer: Mergesort, Quicksort, Recurrences (Levitin ch. 5 + App. B); Ch 11 Decrease-and-Conquer: Insertion Sort, Binary Search, Selection (Levitin ch. 4); Ch 12 Transform-and-Conquer: Presorting, Heaps, Horner's Rule (Levitin ch. 6); Ch 18 Comparison-Based Sorting and Its Lower Bound (Levitin 11.1–11.2); Ch 19 Counting Sort and Radix Sort (Morin 11.2 + Levitin 7.1)
- Discrete Math (Epp): Ch 5.7 Solving Recurrence Relations; Ch 11.4 Recurrence Relations; Ch 9.7–9.8 Binomial Theorem, Probability applications
-
C++ (PPP3): Ch 21 Algorithms (STL algorithms,
std::sort, lambdas, custom comparators); Ch 19 Containers and Iterators
Micro-Projects
-
Sorting Showdown — implement Bubble Sort,
Insertion Sort, Merge Sort, QuickSort; generate random
arrays of size n = 100, 1000, 10000, 100000; compare
runtimes and print a benchmark table. C++ features:
std::vector,std::random, lambdas,std::chrono. -
Dutch National Flag — implement 3-way
partitioning (0s, 1s, 2s) in O(n) time, O(1) space; include
a proof that it's O(n) with constant space.
C++ features:
std::vector, iterators, in-place swapping. -
Binary Search on Custom Data — implement
binary search on a sorted
std::vectorof structs; search by different fields using custom comparators; load data from CSV, sort, allow interactive searches. C++ features:std::sortwith lambdas,std::lower_bound.
Neetcode — Sorting & Divide and Conquer
- Merge Intervals · Sort Colors (Dutch National Flag) · Kth Largest Element in an Array (Quickselect) · Find First and Last Position of Element in Sorted Array · Search Insert Position · Merge Sorted Array
PHASE 4: TREES, HEAPS & ADVANCED STRUCTURES
Reading
- Algorithms Syllabus: Ch 13 Binary Trees and Binary Search Trees (Morin ch. 6 + Levitin 4.5); Ch 14 Randomized and Self-Balancing Trees: Random BSTs, Treaps, Scapegoat Trees (Morin ch. 7–8); Ch 15 Red-Black Trees, AVL Trees, and 2-4 Trees (Morin ch. 9 + Levitin 6.3); Ch 16 Heaps and Heapsort (Morin 10.1 + Levitin 6.4); Ch 17 Meldable and Mergeable Heaps (Morin 10.2)
- Discrete Math (Epp): Ch 10.3–10.5 Graphs (trees, rooted trees, spanning trees, binary trees); Ch 5.8 Recursive algorithms and their analysis
- C++: PPP3 Ch 16 Arrays, Pointers, and References; Ch 17 Essential Operations — + Tour of C++ Ch 7 Concepts and Generic Programming (PPP3 doesn't cover C++20 concepts in depth)
Micro-Projects
-
DIY Binary Search Tree — implement
BST<T>withinsert(),search(),erase(), in-order/pre-order/post-order traversals,min(),max(),successor(),predecessor(). C++ features: recursion, templates,std::unique_ptr. -
Autocomplete with a Trie — implement a Trie
with
insert(word),search(word),startsWith(prefix),autocomplete(prefix); load a dictionary file, interactively autocomplete as user types. C++ features:std::unordered_mapfor children, recursion,std::vector. -
Priority Queue Task Scheduler — implement
priority queue using binary heap; each task has priority and
description; support
push(task),pop(),peek(). C++ features:std::vectoras underlying array, heapify, templates.
Neetcode
Trees: Invert Binary Tree · Maximum Depth of Binary Tree · Subtree of Another Tree · Binary Tree Level Order Traversal · Validate Binary Search Tree · Lowest Common Ancestor of BST · Binary Tree Maximum Path Sum · Construct Binary Tree from Preorder/Inorder · Serialize and Deserialize Binary Tree
Heap / Priority Queue: Find Median from Data Stream · Top K Frequent Elements · Kth Largest Element in a Stream · Last Stone Weight
Trie: Implement Trie (Prefix Tree) · Design Add and Search Words Data Structure · Word Search II
PHASE 5: GRAPH ALGORITHMS
Reading
- Algorithms Syllabus: Ch 20 Graph Representations (Morin ch. 12); Ch 21 Graph Traversal: BFS and DFS (Morin 12.3 + Levitin 3.5); Ch 22 Greedy Algorithms: Prim's, Kruskal's, Dijkstra's (Levitin ch. 9); Ch 23 Dynamic Programming: Floyd–Warshall, Optimal BSTs (Levitin ch. 8); Ch 24 Iterative Improvement: Max-Flow, Matching, Simplex (Levitin ch. 10)
- Discrete Math (Epp): Ch 10.6–10.8 Graphs (traversals, connectedness, directed graphs); Ch 12.1–12.3 Relations (relations, equivalence relations, partial orders); Ch 9.9–9.10 Counting and Probability (expected value, applications)
- C++: PPP3 Ch 20 Maps and Sets — + Tour of C++ Ch 15 Concurrency (PPP3 doesn't cover concurrency; optional here, useful for parallel BFS/DFS)
Micro-Projects
-
Graph Builder and Traversal — build
AdjacencyListGraphclass: adding vertices/edges (directed/undirected), BFS (prints distances from source), DFS (prints discovery/finish times), cycle detection. C++ features:std::vector,std::unordered_map,std::queue,std::stack. -
Shortest Path in a Maze — read a 2D grid
maze from file (
#=wall,.=path,S=start,E=end); use BFS to find shortest path, print with arrows. C++ features:vector<vector<char>>,std::queue,struct Point. -
Kevin Bacon Game — build undirected graph
of actors (vertices) and movies (edges); implement BFS to
find shortest path (Bacon number); interactive CLI.
C++ features:
unordered_map<string, vector<string>>,std::queue, file I/O.
Neetcode
Graphs (BFS/DFS): Number of Islands · Clone Graph · Pacific Atlantic Water Flow · Surrounded Regions · Course Schedule · Course Schedule II
Shortest Path: Network Delay Time (Dijkstra's) · Cheapest Flights Within K Stops (Bellman-Ford) · Path with Minimum Effort
Union Find / MST: Number of Connected Components in an Undirected Graph · Graph Valid Tree · Redundant Connection
Graph Advanced: Word Ladder (BFS) · Alien Dictionary (Topological Sort)
PHASE 6: STRINGS, EXTERNAL MEMORY & ADVANCED DATA STRUCTURES
Reading
- Algorithms Syllabus: Ch 25 Tries and Data Structures for Integers (Morin ch. 13); Ch 26 B-Trees and External-Memory Search (Morin ch. 14 + Levitin 7.4); Ch 27 Input Enhancement in String Matching: Horspool, Boyer–Moore (Levitin 7.2); Ch 28 Closest-Pair and Convex-Hull Problems (Levitin 3.3, 5.5)
- Discrete Math (Epp): Ch 11.5 Amortized analysis (Epp touches this lightly); Ch 7.4 Composition of functions (for string-matching automata)
- C++ (PPP3): Ch 9 Input and Output Streams (revisit, incl. file streams)
Micro-Projects
-
Large Dictionary Autocomplete — extend the
Trie project with file I/O for a large dictionary; support
autocomplete with frequency ranking; implement deletion and
prefix search. C++ features:
std::ifstream,std::unordered_map, file parsing. -
Boyer–Moore String Search — implement
Boyer-Moore and Horspool; benchmark against
std::string::find; test on real text (Project Gutenberg). C++ features:std::string,std::chrono, file I/O. -
Closest-Pair Visualizer — implement
brute-force and divide-and-conquer closest-pair; generate
random points, visualize both approaches; compare runtimes.
C++ features:
std::vectorof structs,std::sort,std::chrono.
Neetcode
String Matching: Longest Substring Without Repeating Characters · Longest Repeating Character Replacement · Minimum Window Substring · Group Anagrams
Sliding Window: Sliding Window Maximum · Longest Substring with At Most K Distinct Characters
Trie (revisited): Design Search Autocomplete System
PHASE 7: LIMITS OF ALGORITHMIC POWER
Reading
- Algorithms Syllabus: Ch 29 Lower-Bound Arguments and Decision Trees (Levitin 11.1–11.2); Ch 30 P, NP, and NP-Completeness (Levitin 11.3); Ch 31 Backtracking and Branch-and-Bound (Levitin 12.1–12.2); Ch 32 Approximation Algorithms (Levitin 12.3); Ch 33 Numerical Algorithms (Levitin 11.4, 12.4)
- Discrete Math (Epp): Ch 2.4 Logical arguments (review); Ch 3.4 Arguments with quantified statements (review); Ch 6.1–6.3 Set Theory (sets, subsets, set operations, Venn diagrams — for P/NP reductions); Ch 7.5 Cardinality of sets, countable/uncountable sets
- C++: Tour of C++ Ch 14 Numerics — PPP3's numerics chapter is web-only supplementary material, not in the printed book
Micro-Projects
-
N-Queens Solver — recursive backtracking
N-Queens; print all solutions for a given n; optimize with
bitmasking. C++ features: recursion,
std::vector, bitwise operators. -
Knapsack Solver: Greedy vs DP vs
Branch-and-Bound
— implement 0/1 Knapsack all three ways; compare solutions
and runtimes. C++ features:
std::vectorof structs, 2D DP table,std::chrono. -
RSA Key Generator — generate two large
primes; compute
n = p*qandφ(n) = (p-1)*(q-1); findeanddsuch thate*d ≡ 1 (mod φ(n)); encrypt and decrypt a message. C++ features:std::random, modular exponentiation,std::gcd. -
TSP Approximation — implement Nearest
Neighbor heuristic for TSP; compare to optimal (brute force
for small n); visualize the tour. C++ features:
std::vector,std::set,std::chrono.
Neetcode
Backtracking: Subsets · Subsets II · Combination Sum · Combination Sum II · Permutations · N-Queens · Sudoku Solver
Dynamic Programming (1D): Climbing Stairs · House Robber · House Robber II · Decode Ways · Coin Change · Coin Change II
Dynamic Programming (2D): Longest Palindromic Substring · Edit Distance · Unique Paths · Minimum Path Sum · Longest Common Subsequence
Dynamic Programming (Advanced): Word Break · Word Break II · Maximum Product Subarray · Best Time to Buy and Sell Stock (all versions)
PHASE 8: APPENDICES & INTEGRATION
Reading
- Algorithms Syllabus: Appendix A Useful Formulas for Algorithm Analysis (supports Ch 2–4); Appendix B Recurrence Relations (supports Ch 10); Appendix C Space-Efficiency Notes on Linked Structures — SEList (supports Ch 7)
- Discrete Math (Epp): Ch 5.9 Recurrence relations review; Ch 9.1–9.10 Counting and Probability (full review); Ch 11.1–11.4 Analysis of Algorithm Efficiency (full review)
- C++ (PPP3): Ch 17 Essential Operations (revisit — memory efficiency)
Micro-Project
-
Recurrence Solver — write a program that
takes a recurrence (e.g.,
T(n) = 2T(n/2) + n), computes values for n = 1..100, verifies the closed-form solution, visualizes the growth pattern. C++ features:std::function, recursion with memoization,std::map.
Neetcode — review
Median of Two Sorted Arrays (revisit with recurrence understanding) · Merge k Sorted Lists (revisit with heap understanding) · Trapping Rain Water (revisit with two-pointer)
PHASE 9: THE MACRO-PROJECT
All Content Applied — Choose One Capstone
Option A: Real-Time Route Planner
- Apply: Graphs (Ch 20–22), Heaps (Ch 16), DP (Ch 23); File I/O, Concurrency, Containers; Dijkstra, BFS, topological ordering
- Features: load road network from file; shortest path with Dijkstra + A*; dynamic edge weights for traffic; route display with progress; multi-waypoint support (DP)
Option B: Full-Text Search Engine
- Apply: Hash Tables (Ch 8), Tries (Ch 25), Sorting (Ch 18), String Matching (Ch 27); File I/O, Strings, Containers; Trie, Word Search, Group Anagrams
-
Features: inverted index with
unordered_map; boolean query parser; TF-IDF ranking; Trie autocomplete; persistent index on disk
Option C: Network Packet Routing Simulator
- Apply: Max-Flow (Ch 24), Dijkstra (Ch 22), Convex Hull (Ch 28); Concurrency, Random Numbers, I/O; graph algorithms, topological sort
- Features: simulate network of routers; route packets along shortest path; handle congestion and rerouting; log throughput/latency; visualize topology
Option D: Cryptography Toolkit
- Apply: RSA (Ch 33), Modular Arithmetic (Ch 33), P/NP (Ch 30); Numerics, Random, Strings; math problems
- Features: RSA key generation and encryption; Diffie-Hellman key exchange; simple SHA-256; digital signatures; file encryption/decryption
Neetcode
Ongoing alongside the capstone — focus on Hard problems you previously skipped, revisit Medium problems from early phases, simulate interview conditions (30 min/problem).
Beyond the Roadmap
The roadmap builds the substrate. Each step past it swaps in a new language on purpose — because each gap is best closed in the language built for it, not by forcing everything back through C++.
Compiler — OCaml, via Real World OCaml. Algebraic data types and pattern matching fit ASTs and type checkers cleanly. Build it in OCaml, not just after reading about it — your recursion-heavy phases (4, 5, 7) already prime the functional instincts this needs.
Distributed KV store — Rust, via The Rust Book. Rust's ownership model formalizes the RAII discipline from Phases 2 and 4, so this reads more like a stricter dialect of what you already know than a new paradigm. Pair it with a from-scratch Raft implementation — the book teaches the language, not consensus.
Full-stack / microservices — Go + JS. Let's Go and Let's Go Further (Alex Edwards) cover the backend in Go: routing, middleware, a real database layer, auth, deployment. Eloquent JavaScript covers the frontend. Containers, service discovery, and message queues remain open past a single Go service — that's the step into microservices proper.
| Step | Language | Resource |
|---|---|---|
| 1. This roadmap | C++ | PPP3 → Tour of C++ (later phases) |
| 2. Compiler | OCaml | Real World OCaml |
| 3. Distributed KV store | Rust | The Rust Book |
| 4. Full-stack / microservices | Go + JS | Let's Go / Let's Go Further, Eloquent JavaScript |
No deadline. Just don't stop.