Core paths · 13 steps
Complete DSA
All 35 curriculum modules in teaching order, grouped into stages, with the patterns, problems and visualizers that go with each stage.
- Who it is for
- Anyone who wants the whole curriculum in a deliberate order, from algorithmic thinking to advanced problem solving.
- By the end
- You have met every structure and technique in the curriculum, practised the related patterns, and can combine them on unfamiliar problems.
Step 1: Foundations
Precise thinking, the memory model and Big O are prerequisites for judging anything that follows.
- ModuleM01 Algorithmic Thinking· beginner
- ModuleM02 Memory Model· beginner
- ModuleM03 Big O· beginner
- Complexity exerciseA loop inside a loop· Θ(n²)
- Complexity exerciseA linear loop around a doubling loop· Θ(n log n)
Step 2: Collections, arrays and strings
Contiguous storage is the default representation; the library collections are what you will actually use.
- ModuleM04 Built-in Collections· beginner
- ModuleM05 Arrays· beginner
- ModuleM06 Strings· beginner
- LessonDynamic arrays: capacity, resizing and amortized append· M05 Arrays
- VisualizerDynamic array· append amortized O(1); insert/remove O(n)
- ProblemShift the schedule by k days· intermediate · O(n)
Step 3: Linked lists, stacks and queues
Pointer-based nodes and the two access disciplines (LIFO, FIFO) appear in parsing, scheduling and graph search.
- ModuleM07 Linked Lists· beginner
- ModuleM08 Stacks· beginner
- ModuleM09 Queues and Deques· beginner
- VisualizerSingly linked list· prepend/append O(1); find/remove O(n)
- VisualizerStack· push/pop amortized O(1)
- VisualizerQueue (ring buffer)· enqueue/dequeue O(1)
- ProblemDo the brackets close properly?· beginner · O(n)
Step 4: Hashing
Hash maps and sets come before the patterns because so many patterns keep their state in one.
- ModuleM10 Hash Tables and Sets· intermediate
- VisualizerHash table· put/get/remove expected O(1)
- PatternHashing for constant-time lookup· O(n) expected
- ProblemTwo readings that add up to a target· beginner · O(n) expected
- ProblemHas any badge been scanned twice?· beginner · O(n) expected
- ProblemSame letters, different order?· beginner · O(n) expected
Step 5: Recursion, searching and sorting
Recursion is needed for merge sort and trees; searching and sorting are the first algorithms with non-trivial invariants.
- ModuleM11 Recursion· intermediate
- ModuleM12 Searching· beginner
- ModuleM13 Sorting· intermediate
- LessonBinary search: halving a sorted range· M12 Searching
- LessonMerge sort: split, merge and the auxiliary buffer· M13 Sorting
- VisualizerBinary search· O(log n)
- VisualizerBubble sort· O(n²) worst, O(n) sorted
- VisualizerMerge sort· Θ(n log n)
Step 6: Array patterns
Two pointers, sliding windows, prefix sums and boundary binary search are the workhorse techniques for array and string questions.
- ModuleM14 Two Pointers· intermediate
- ModuleM15 Sliding Window· intermediate
- ModuleM16 Prefix Sum and Difference Array· intermediate
- ModuleM17 Binary Search Patterns· intermediate
- PatternTwo pointers· O(n)
- PatternSliding window· O(n)
- PatternPrefix sums· O(n) build, O(1) per query
- PatternBinary search on a monotonic predicate· O(log R × cost of ok)
- PatternMonotonic stack· O(n)
- ProblemTwo walls that hold the most water· intermediate · O(n)
- ProblemRed, white and blue in one pass· intermediate · O(n)
- ProblemThe longest stretch without a repeated letter· intermediate · O(n) expected
- ProblemHow many stretches add up to k?· intermediate · O(n) expected
- ProblemWhere does a value start and end?· intermediate · O(log n)
- ProblemHow many days until it gets warmer?· intermediate · O(n)
Step 7: Trees and search trees
Hierarchical structures and balance explain ordered maps and database indexes.
- ModuleM18 Trees· intermediate
- ModuleM19 Binary Search Trees· intermediate
- ModuleM20 Balanced Trees· advanced
- VisualizerTree traversal· Θ(n)
- PatternBreadth-first search and level order· O(V + E)
Step 8: Heaps and tries
Two specialised trees: heaps for repeated minimum or maximum, tries for prefix queries.
- ModuleM21 Heaps and Priority Queues· intermediate
- ModuleM22 Tries· intermediate
- PatternTop K with a heap· O(n log k)
- Collectionheapq· Python
Step 9: Graphs
Graphs generalise trees; traversal, ordering, connectivity and shortest paths are learned together because they share the same representation.
- ModuleM23 Graph Fundamentals· intermediate
- ModuleM24 BFS and DFS· intermediate
- ModuleM25 Topological Sort· intermediate
- ModuleM26 Shortest Paths· advanced
- ModuleM28 Union Find· intermediate
- ModuleM27 Minimum Spanning Trees· advanced
- PatternDepth-first search and backtracking· O(V + E) for graph DFS; O(2ⁿ) subsets, O(n!) permutations
- PatternTopological ordering· O(V + E)
- PatternUnion-find for connectivity· O(α(n)) amortized per operation
Step 10: Divide and conquer, greedy, backtracking
General strategies for designing algorithms, each with its own proof technique and failure modes.
- ModuleM29 Divide and Conquer· intermediate
- ModuleM30 Greedy· advanced
- ModuleM31 Backtracking· intermediate
- PatternGreedy choice after sorting· O(n log n)
- PatternSort and merge intervals· O(n log n)
- ProblemBuy once, sell once, profit most· beginner · O(n)
- Complexity exerciseGenerating every subset· Θ(n · 2ⁿ) including copying; 2ⁿ outputs
Step 11: Dynamic programming
Builds on recursion and backtracking: the same search, but each state solved once.
- ModuleM32 Dynamic Programming· advanced
- PatternDynamic programming (1D and 2D)· O(states × transitions)
- PatternOne pass with a running state· O(n)
- ProblemHow many ways up the stairs?· beginner · O(n)
- ProblemCollect the most without taking neighbours· intermediate · O(n)
- ProblemThe best streak of daily profits· intermediate · O(n)
- Complexity exerciseFilling an n × n table· Θ(n²)
Step 12: Bits and math
Number representation and arithmetic identities give O(1)-space answers and avoid overflow bugs.
- ModuleM33 Bit Manipulation· intermediate
- ModuleM34 Math· intermediate
- PatternBit tricks and arithmetic invariants· O(n) scans; O(set bits) popcount; O(log min(a, b)) gcd
- ProblemThe sock without a pair· beginner · O(n)
- ProblemCount the 1 bits· beginner · O(number of 1 bits) ≤ O(width)
- ProblemThe one ticket that never came back· beginner · O(n)
- ProblemThe largest tile that fits both walls· beginner · O(log min(a, b)) iterations
Step 13: Advanced problem solving
The final module combines structures and patterns and practises recognising them from constraints alone.
- ModuleM35 Advanced Problem Solving· advanced
- ProblemEvery product but your own· intermediate · O(n)
- ProblemWhich candidate has more than half the votes?· intermediate · O(n)