Cost a sequence, and label the cost
Run an operation sequence on a named structure and say whether its cost is worst-case, amortised or expected — three different promises that a single measurement cannot tell apart.
Discrete Mathematics analysed algorithms and never built a structure to run one on. This course builds eight, and costs each by executing an operation sequence rather than by quoting a class — because the interesting facts here are all about the difference between a worst case, an amortised bound and an expectation, and those three are indistinguishable from a single fast run.
Overview
By the end you can cost an operation sequence on any of eight structures, say for each cost whether it is worst-case, amortised or expected, and choose a structure from a workload while naming what the choice cannot do.
Run an operation sequence on a named structure and say whether its cost is worst-case, amortised or expected — three different promises that a single measurement cannot tell apart.
Heap insert and extract, hash insert with chaining and with probing including deletion, search-tree insert and two-child delete, and AVL rebalancing with the case named.
Build-heap's Σ h/2ʰ, chaining's 1 + α, AVL's Fibonacci height, and union by rank's log n — each proved once, and each one the reason a later course can quote a cost without re-deriving it.
From an operation mix, pick among sorted array, hash table, AVL tree, heap and union–find, and name the operation the winner cannot answer at all.
Lessons
Sequences first, because their cost model is the vocabulary; then the three structures that trade a different thing for search — a heap trades order, a hash table trades order and worst case, a search tree trades constants; then balance, augmentation, and the one structure that is not a container at all.
Discrete Mathematics in full, and by name: Big-O Notation, Analysing Iterative Algorithms, Recursion Trees and Amortised Analysis, Trees, Tree Traversals, Graph Representations, Hashing and Pseudorandom Numbers, and Linearity of Expectation.
Run the sequence before reading the bound. Every lab on this course counts an execution, and the number it prints is the answer for that sequence only. The bound is the lesson's claim about all of them.
When a cost is amortised, find the expensive operation. It is still there, it still happens, and the guarantee is about the total. A reader who cannot point at it has read the bound as “always fast”.
Break the structure deliberately. The degenerate key set, the sorted insertion order, the delete that empties a slot: each lab can produce the input that defeats its structure, and that input is the lesson.
Red–black trees and B-trees. AVL stands in for balance, and B-trees are about disk — System Design's “The Height of a B-tree” costs one in I/O, which is the reason they exist.
Fibonacci heaps, and AVL deletion. Both are stated and neither is developed; the first changes Dijkstra's bound and no lesson here depends on the change.
The proof of union–find's α(n) bound. The statement is used; the proof is out of scope, and “Union–Find” says so in those words.
Cache-aware and persistent structures. The cost model here is the word RAM, where every access costs one.