Data Structures book cover

Your technical library

Data Structures

14 modules · 62 topics

About this book
Concepts · Data Structures

Data Structures

This course teaches how to choose and build the right way to hold data: start from a workload, pick a representation, state the rule it must keep true after every update, derive its operations and what each one costs, and know when another representation wins. It is written for any engineer who uses lists, maps and sets without having been taught why one is fast and another is not. It assumes no other course; Algorithms builds on it.

Foundations sets up workloads, cost models, invariants and amortised cost. Sequences and memory covers arrays, packed and linked lists, ring buffers and editable text, and maps and sets covers hashing, probing, growth, locality and eviction. Ordered structures builds search trees — balanced, randomised and augmented — up to in-memory B-trees, and priority and frontier structures builds heaps. Range queries answers questions about intervals quickly, text indexes searches by prefix and suffix, and graphs and connectivity state stores graphs and tracks which parts are connected.

The advanced modules keep old versions cheaply (versions and structural sharing), trade exactness for space (probabilistic structures, for membership, frequency, counting and quantiles), index points and vectors (spatial and vector indexes) and squeeze a structure close to the smallest size its information allows (succinct representations). Engineering collection contracts covers what real libraries add — handles, concurrency and measurement — and worked design decisions puts everything to work on real workloads. Each topic says what it inherits, what it leaves open, and when a simpler structure wins.

62 topics across 14 modules, in dependency order.

Code conventions: where a lesson has code, it states language-neutral pseudocode first, then Python using the names from the worked trace. Short C/C++ excerpts appear only when layout, allocation, ownership, or machine-level behaviour is the point.

62 of 62 topics are authored; the rest are marked as planned. Read in dependency order: each topic opens with the problem earlier topics left open and closes with what it still leaves open.

Course map

Read at your own pace. Each topic is one continuous page; mark it done as you finish.

Start with 01.1 · Workloads and contracts: start with the operationsReview what you have finished