01Chapter 1: Start with the operations, not the structureThis chapter assumes you can write Python loops and functions, and that you use lists and dictionaries. You should know roughly what Big-O notation means: it describes how the cost of an operation grows with input size. Later chapters cover Big-O in more detail.3 min read
02Chapter 2: Reading operation costsThis chapter assumes you can write Python loops and functions, and that you have seen Big-O notation before. Here you will learn to read a cost table and use it to compare structures on the operations your problem needs.3 min read
03Chapter 3: Arrays and dynamic lists: fast indexing, costly middle editsThis chapter assumes you know basic Python, loops and functions, and have a rough idea of what Big-O notation means. It covers the structure behind Python's list and explains which operations it makes cheap and which it makes expensive.2 min read
04Chapter 4: Linked lists: when they help and when they do notThis chapter assumes you know Python lists and dictionaries, can read Big-O notation, and have read the previous chapter on arrays and dynamic lists. It covers what a linked list does well, what it does badly, and why Python code rarely needs one.3 min read
05Chapter 5: Hash tables: fast lookup and membershipThis chapter assumes you know Python lists and dictionaries, can read basic Big-O notation, and have seen the cost of scanning a list. It covers how hash tables work, what they make cheap, and the errors that trip people up.3 min read
06Chapter 6: Stacks, queues and deques: ordering by arrivalThis chapter assumes you know Python lists, loops and functions, and that you have a rough idea of Big-O. Earlier chapters covered the cost of list operations. Here the question is different. Sometimes the right structure is the one that limits how you reach your data, so that items come out in the 2 min read
07Chapter 7: Heaps: always getting the smallest or largest itemThis chapter assumes you know Python lists and dictionaries, can read Big-O notation, and have read the earlier chapters on arrays and hash tables. It covers when a heap is the right choice and how to use Python's heapq module.3 min read
08Chapter 8: Ordered structures: sorted data, ranges and neighborsThis chapter assumes you know Python lists and dictionaries, can read Big-O notation, and have seen how hash tables work. A hash table answers "is this key present?" very quickly. It cannot answer "what is the next key after this one?" or "which keys fall between 20 and 40?". Ordered structures answ3 min read
09Chapter 9: Graphs: modeling relationships and traversalsThis chapter assumes you know Python lists, dictionaries and sets, and have a rough idea of Big-O. It also assumes you have seen the hash table and queue chapters. Graphs reuse both.3 min read
10Chapter 10: Tries: prefix search over stringsThis chapter assumes you know Python dictionaries, recursion, and the cost of hash lookups from the earlier chapters. A trie (also called a prefix tree) is a tree where each edge is labeled with one character. A path from the root spells a prefix, and a flag on a node marks where a complete word end2 min read
11Chapter 11: Union-find: tracking connected groupsThis chapter assumes you know Python dictionaries and loops, and have a rough idea of Big-O. It also assumes you have seen graphs from the previous chapters.2 min read
12Chapter 12: Memory layout and constant factorsThis chapter assumes you know Big-O notation, Python lists, dictionaries and sets, and the structures from the earlier chapters. Big-O describes how cost grows with input size. It ignores the fixed cost of each step, and it ignores where the data sits in memory. Both can decide which structure is fa2 min read
13Chapter 13: A checklist for choosing a structureThis chapter assumes you know Python lists, dictionaries and sets, can read Big-O notation, and have seen the structures covered earlier: arrays, hash tables, deques, heaps, ordered structures and graphs. Here you combine them into a repeatable decision process.2 min read
14Chapter 14: Common mistakes and how to avoid themThis chapter assumes you know Python lists, dictionaries and sets, and have a rough idea of Big-O. It collects the selection mistakes that cause most real problems. Each one comes from skipping a step in the checklist from the previous chapter: name the operations, estimate how often each runs, then3 min read