🧮

Data Structures and Algorithms

From complexity analysis to dynamic programming, from hash table internals to B+Tree indexes. 43 chapters covering interview patterns, engineering applications, and classical proofs. All Python code is runnable.

43
Chapters
Free
Forever
Start Reading →
Table of Contents
Ch01
Complexity: The Ruler for Code Speed
Big-O/Ω/Θ, amortized analysis, and why constants sometimes matter more than O
Ch02
Arrays: The Power and Price of Contiguous Memory
Memory layout, cache friendliness, and Python list source code analysis
Ch03
Prefix Sums and Difference Arrays
1D/2D prefix sums, difference arrays, range updates and queries
Ch04
Linked Lists: The Art of Pointers
Singly/doubly/circular lists, reversal, merging, cycle detection, skip lists
Ch05
Stacks: The Magic of LIFO
Call stacks, expression evaluation, bracket matching
Ch06
Monotone Stacks and Monotone Queues
Next greater element, trapping rain water, sliding window maximum
Ch07
Queues and Deques
BFS basics, circular queues, deques
Ch08
Hash Tables: The Cost of O(1)
Hash functions, collision resolution, Python dict internals, consistent hashing
Ch09
Bloom Filters and Probabilistic Data Structures
Bloom filter math, Count-Min Sketch, HyperLogLog
Ch10
Binary Trees: Where Recursive Thinking Begins
Four traversals, recursion vs iteration, serialization, LCA
Ch11
BSTs and Balanced Trees
AVL rotations, red-black trees, why Linux CFS uses red-black trees
Ch12
Heaps and Priority Queues
Binary heaps, heapq internals, Top-K, merging K sorted lists
Ch13
Tries and Aho-Corasick Automaton
Trie trees, autocomplete, Aho-Corasick for content filtering
Ch14
Segment Trees and Binary Indexed Trees
Range queries/updates, lazy propagation, inversion counting
Ch15
Union-Find: The Connectivity Powerhouse
Path compression, union by rank, application in Kruskal's algorithm
Ch16
Graph Representation and Traversal
Adjacency matrix/list, BFS/DFS, connected components, bipartite graphs
Ch17
Topological Sort and Directed Graphs
Course schedule problems, build dependencies, cycle detection
Ch18
Shortest Paths and Minimum Spanning Trees
Dijkstra/Bellman-Ford/Floyd, Prim/Kruskal
Ch19
Strongly Connected Components and Network Flow
Tarjan/Kosaraju, bipartite matching, max flow
Ch20
B-Tree, B+Tree and LSM-Tree
MySQL indexes, LevelDB/RocksDB, Redis sorted sets
Ch21
Sorting: From Bubble Sort to TimSort
Eight sorting algorithms compared, TimSort internals, external sorting
Ch22
Binary Search: Simple Enough to Get Wrong
Half-open vs closed intervals, bisect internals
Ch23
Two Pointers and Sliding Window
Fast-slow pointers, two-sum pattern, minimum window substring
Ch24
Recursion and Divide-and-Conquer
Merge sort, fast exponentiation, Karatsuba multiplication
Ch25
Backtracking: Elegant Brute Force
Permutations/combinations/subsets, N-Queens, pruning strategies
Ch26
Greedy Algorithms: Betting on Local Optimum
Huffman coding, interval scheduling, greedy correctness proofs
Ch27
Dynamic Programming I: 1D and Knapsack
State definition, transition equations, 0-1/unbounded knapsack
Ch28
Dynamic Programming II: Sequences and Intervals
LCS/LIS/edit distance, interval DP
Ch29
Dynamic Programming III: Tree DP and Bitmask DP
Tree DP, bitmask DP, digit DP, game theory DP
Ch30
String Matching: From Brute Force to KMP
KMP full derivation, Boyer-Moore, Rabin-Karp, Z-function
Ch31
Multi-Pattern Matching and Aho-Corasick
Failure links on Trie, content filtering in practice
Ch32
Suffix Arrays and Suffix Automata
SA-IS construction, LCP arrays, suffix automaton
Ch33
Flexible Matching and Regex Engines
Edit distance, Myers diff, NFA to DFA, regex engine internals
Ch34
Bit Manipulation: Thinking Close to Hardware
XOR tricks, bitmaps, state compression
Ch35
Number Theory and Mathematical Foundations
GCD, prime sieves, modular exponentiation, combinatorics
Ch36
Randomized and Probabilistic Algorithms
Fisher-Yates shuffle, reservoir sampling, SkipList random levels
Ch37
Complexity Theory: P, NP and NP-Complete
Turing machines, reductions, why some problems have no fast algorithms
Ch38
Design Data Structures
LRU/LFU implementation, min stack, randomized set
Ch39
Production Algorithms: Rate Limiting and Scheduling
Token bucket, leaky bucket, sliding window, load balancing
Ch40
Data Structure Selection Guide
Decision trees by scenario, time/space/cache/concurrency comparison
Ch41
Cracking the Interview: Patterns and Frameworks
UMPIRE method, 15 high-frequency problem categories
Ch42
From Algorithms to System Design
Consistent hashing, CRDT, Raft — linking to Redis/Kafka/MySQL books
Ch43
Learning Path and Practice Guide
Difficulty-graded practice roadmap, curated 200-problem list

💬 Comments