Lecture notes on Algorithms
These notes are for an undergraduate course on algorithms, covering the usual topics, but with more of an emphasis on learning to do proofs than is found in most courses. We take the perspective that being able to verify correctness (via detailed proofs) is an integral part of learning to design algorithms.
draft of September 29, 2026, by N. Young. Built from github.com/nealeyoung/algs101.
Notes (PDF)
- Preliminaries
- Long-Form Proofs
- Stable Matching
- Divide and Conquer
- Greedy Algorithms
- Graph Traversal
- Dynamic Programming
- Flow, Reductions, and Linear Programming
- NP
Homework assignments
- Preliminaries, Long-Form Proofs, Stable Matching
- Asymptotic (Θ) notation
- Proof about big-O
- Proof by induction (a mysterious recursive function)
- An instance with only one stable matching
- Checking a proof about the 1951 algorithm
- PDF,
template,
Overleaf
- Preliminaries, Stable Matching, Divide and Conquer
- Ordering functions by growth rate (big-O)
- Bounding sums (geometric sums)
- Recursion trees
- Recursion trees: a variant of mergesort
- Busy hospitals (prove or disprove)
- Lonely doctor (prove or disprove)
- PDF,
template,
Overleaf
- Divide and Conquer
- Recurrences
- 2D Local Maximum: an incorrect algorithm
- Bus routes
- PDF,
template,
Overleaf
- Greedy Algorithms
- Activity Selection (simulating rselect and iselect)
- Making Change: when is the greedy algorithm optimal?
- Puncturing Intervals: the greedy step
- PDF,
template,
Overleaf
- Greedy Algorithms, Graph Traversal
- Puncturing Intervals: the full algorithm
- Breadth-first search
- Depth-first search
- PDF,
template,
Overleaf
- Greedy Algorithms, Graph Traversal
- Depth-first search and topological sort
- Prim's algorithm (Minimum Spanning Tree)
- Minimum Spanning Tree: checking a conjecture and proof
- Dijkstra's algorithm
- Street sweeping (a DFS-based algorithm; HackerRank)
- PDF,
template,
Overleaf
- Dynamic Programming
- Shortest path in a grid
- Making Change
- Counting Ways to Make Change
- Dijkstra's algorithm: a conjecture
- PDF,
template,
Overleaf
- Dynamic Programming, Greedy Algorithms
- Scheduling light and heavy jobs
- Counting valid subsequences
- The Game of Piles
- Minimum Spanning Tree: the reverse-delete (cycleBreaker) algorithm
- PDF,
template,
Overleaf
- Dynamic Programming, Flow
- Counting Subset Sums
- Smallest Subset Sum
- Three-Way LCS
- Finding a maximum flow and a minimum cut
- PDF,
template,
Overleaf
- Flow, Reductions, LP
- Tiling by bars (via Bipartite Matching)
- Solving small linear programs
- Critical edges, or a conjecture about maximum flows
- PDF,
template,
Overleaf
- Flow, Reductions, P and NP
- Family seating (via Max Flow)
- K-Path
- PDF,
template,
Overleaf
Code
The Python code, on GitHub (all files),
by lecture note. Each lecture note also lists its code in its last section.
© 2018–2026 Neal E. Young.
The notes and homeworks are licensed under CC BY-NC-SA 4.0
and the code under the MIT License, except where noted; see LICENSE.