The Little Book of Algorithms
Version 0.2.0
Contents
Volume 1 — What Is an Algorithm?
- Problems, procedures, and precision
- Inputs, outputs, and assumptions
- Deterministic vs. nondeterministic steps
- Decomposing big problems into small ones
- Abstraction: hiding details to see structure
- Representing data: numbers, text, and simple records
- Correctness as a promise: pre/postconditions
- Cost as effort: time, memory, and simplicity
- Algorithms vs. heuristics: when “good enough” wins
- A tiny toolbox: three everyday recipes (sum, max, count)
Volume 2 — Describing Algorithms Clearly
- Pseudocode that reads like plain English
- Flowcharts and step diagrams
- Tracing by hand: dry runs on small examples
- Input modeling: choose the right shape for data
- Edge cases: empties, extremes, and errors
- Step-invariants: what stays true while we work
- Assertions and sanity checks
- Naming things and writing clear steps
- Turning pictures into procedures
- From idea to draft algorithm
Volume 3 — Reasoning About Cost (Complexity Without Tears)
- Constant time vs. growing time
- Counting simple loops
- Nested loops as grids of work
- Best, average, worst case thinking
- Space cost and data copies
- Big-O intuition (skip the calculus)
- Practical performance vs. asymptotics
- Lower bounds as “can’t do better than”
- Trade-offs: time vs. space vs. simplicity
- Measuring in practice: micro-bench basics
Volume 4 — Data Building Blocks I: Arrays, Lists, Queues, Stacks
- Arrays: indexed shelves
- Traversal patterns and two-pointers
- Dynamic arrays: growth and amortized cost
- Linked lists: chains of nodes
- Insert, delete, and search patterns
- Stacks: undo, parse, and backtrack
- Queues: first-in first-out thinking
- Deques and circular buffers
- Choosing between list and array
- Real-world mini-projects (logs, history, task queues)
Volume 5 — Data Building Blocks II: Trees, Hashes, and Graphs (Gentle)
- Trees as nested boxes
- Binary trees and traversal orders
- Balanced vs. unbalanced intuition
- Hash tables: buckets from good mixing
- Handling collisions: chaining and open addressing
- Sets and maps as interfaces
- Graphs as connections: nodes and edges
- Adjacency lists vs. matrices
- Weighted, directed, and bipartite basics
- Modeling real problems with graphs
Volume 6 — Searching and Sorting Fundamentals
- Linear search and sentinel tricks
- Binary search: halving the haystack
- Sorting goals and stability
- Selection: find min/max, kth element
- Insertion sort: simple and local
- Merge sort: split, sort, merge
- Quick sort: partition and pivot
- Counting and bucket sort: when keys are small
- Practical mixtures and fallbacks
- Where sorting shows up in life
Volume 7 — Recursion & Divide-and-Conquer
- The recursive mindset: self-reference safely
- Base cases and progress measures
- Visualizing call stacks
- Classic examples (factorial, Fibonacci, binary search)
- Divide-and-conquer pattern
- Recurrence intuition (without heavy math)
- Tail recursion and iteration conversion
- Handling duplicates and boundaries cleanly
- Debugging recursive code
- Recursion in real tasks (parsing, image quadrants)
Volume 8 — Greedy Algorithms
- What “locally best” means
- Exchange arguments (why greedy can be right)
- Interval scheduling and activity selection
- Making change (when greedy works, when it fails)
- Huffman coding intuition
- Spanning trees with a greedy flavor
- Greedy on graphs: pitfalls and patterns
- Greedy vs. dynamic programming: choose wisely
- Counterexamples as teaching tools
- Greedy checklists before you code
Volume 9 — Dynamic Programming (DP) for Humans
- Overlapping subproblems and optimal substructure
- From recursion to memoization
- Bottom-up tables and state diagrams
- Longest common subsequence (LCS) story
- Knapsack as choices on a grid
- Path counting on grids with obstacles
- Edit distance and spell-check vibes
- Reconstructing solutions from tables
- Space-saving DP tricks
- Recognizing DP opportunities in the wild
Volume 10 — Graph Algorithms I: Exploration
- BFS: layers and shortest hops
- DFS: depth trails and classification of edges
- Connectivity: components and islands
- Detecting cycles (directed/undirected)
- Topological sort on DAGs
- Using parents, levels, and timestamps
- Flood fill and maze solving
- Graph modeling patterns (grids, states)
- Traversal pitfalls: visited sets and resets
- When not to use graphs
Volume 11 — Graph Algorithms II: Paths and Trees
- Weighted shortest paths mindset
- Dijkstra: non-negative weights
- Bellman–Ford: handle negatives carefully
- All-pairs sketch: repeated single-source
- Minimum spanning trees: cut and cycle views
- Kruskal vs. Prim: data structure choices
- Union-Find (Disjoint Set Union) basics
- DAG shortest paths as DP
- Graph heuristics in practice (A* intuition)
- Modeling road networks and deliveries
Volume 12 — Strings, Text, and Patterns
- Strings as arrays of characters
- Naive pattern matching and sliding windows
- Prefix-function intuition (KMP idea, gently)
- Z-function and borders (conceptual)
- Rolling hash and Rabin–Karp
- Tries for dictionaries and autocomplete
- Simple compression ideas (run-length, Huffman revisit)
- Tokenization and normalization basics
- Anagrams, palindromes, frequency maps
- Real tasks: search, dedup, and logs
Volume 13 — Geometry and Spatial Algorithms
- Points, vectors, and distances (no heavy math)
- Orientation tests: left, right, collinear
- Bounding boxes and collision checks
- Line segments: intersect or not
- Polygons: perimeter, area, and winding
- Grid geometry: raster thinking
- Closest pair (divide-and-conquer idea)
- Convex hull intuition
- Spatial indexing intuition (quadtrees)
- Practical tasks: maps, games, and UI hit-testing
Volume 14 — Probability & Randomized Algorithms (Gentle)
- Randomness as a tool, not magic
- Sampling fairly and shuffling
- Reservoir sampling for streams
- Monte Carlo vs. Las Vegas algorithms
- Randomized quickselect intuition
- Hashing and probabilistic data structures (bloom filter intuition)
- Expectations without heavy formulas
- Estimating large counts (Flajolet–Martin idea)
- Random walks and simple simulations
- When to prefer randomized approaches
Volume 15 — Backtracking & Constraint Search
- State spaces and search trees
- Backtracking skeleton (choose → explore → undo)
- Pruning with constraints
- Permutations, combinations, and subsets
- Sudoku/N-Queens: patterns of pruning
- Ordering choices to speed up search
- Constraint propagation intuition
- Branch and bound basics
- Detecting impossibility early
- Turning search into solutions you can explain
Volume 16 — Numbers, Data, and Simple Numerics
- Integer limits, overflow, and safe arithmetic
- Fixed vs. floating-point intuition
- Summation stability and Kahan idea (gently)
- Binary, decimal, and bases
- Greatest common divisor and Euclid
- Prime checks (simple) and factoring (why it’s hard)
- Modular arithmetic intuition
- Root finding with bisection (no calculus)
- Interpolation and simple smoothing
- Units, precision, and error budgets
Volume 17 — Working with Big Data (Beginner-Level Ideas)
- Memory vs. disk: locality matters
- Chunking and batching
- External sorting idea
- Streaming: one pass, small memory
- Map-Reduce as a mental model
- Sketches for big counts (count-min intuition)
- Windowed aggregates on streams
- Caching and eviction (LRU intuition)
- Parallelism vs. concurrency (plain language)
- Practical hygiene: logs, checkpoints, retries
Volume 18 — Practical Algorithms in Everyday Software
- Rate limiting (token/leaky bucket intuition)
- Consistent hashing (balanced placement idea)
- Pagination, search, and ranking basics
- Recommendation heuristics (co-occurrence intuition)
- Deduplication and fuzzy matching
- Scheduling jobs and throttling
- Pathfinding in apps and games
- Simple image operations (filters as kernels)
- Text pipelines (tokenize → normalize → index)
- “Good enough” engineering: latency and budgets
Volume 19 — Designing Algorithms: A Playbook
- Clarify the goal and constraints
- Model the data and operations
- Choose patterns: brute force → prune → optimize
- Identify invariants and loop structure
- Prove or test correctness (lightweight)
- Estimate cost and pick the right order of growth
- Simplify first; optimize last
- Reuse libraries vs. reinventing
- Communicate the approach (diagrams & docs)
- Post-mortems: learn from misses
Volume 20 — Capstones, Case Studies, and Practice
- Route planner for a small city (graphs)
- Personal finance analyzer (arrays, scans, DP lite)
- Study planner/scheduler (greedy + constraints)
- Document search and dedup (strings + hashing)
- Inventory allocator (greedy vs. DP trade-offs)
- Game pathfinding and AI (BFS/A*)
- Image cleanup mini-tool (filters + queues)
- Log analyzer for trends (streaming + sketches)
- Data cleaning pipeline (practical robustness)
- Build your own algorithm notebook (templates, checklists)