Classify a sort on four promises
Stability, in-place, adaptivity and comparison versus key-based — and pick one for a stated key domain and memory limit, which is a different question from picking the fastest.
Discrete Mathematics proved no comparison sort beats n log n. That leaves open everything that matters: stability, whether the bound applies at all, what randomness buys, and how close to the bound a real sort gets. This is also the course where the analysis becomes probabilistic — randomised quicksort's exact expectation is the pattern every later expectation on this path follows.
Overview
By the end you can classify any sort on four promises, derive randomised quicksort's expectation with indicator variables and check it against a measured mean, and prove a lower bound by playing an adversary.
Stability, in-place, adaptivity and comparison versus key-based — and pick one for a stated key domain and memory limit, which is a different question from picking the fastest.
Partition, quicksort, heapsort, counting sort, radix sort, quickselect and median of medians, each with its counter and its invariant.
The indicator argument for 2(n+1)Hₙ − 4n, evaluated exactly as a fraction and compared with a mean over seeds — and the reason it holds for every input rather than for a typical one.
Answer comparisons so as to keep the most outcomes alive, for the maximum, for min-and-max together, and for the second largest — then meet each bound with an algorithm.
Lessons
What a sort promises, then quicksort and the expectation it needs, then the sorts that escape the comparison bound by not comparing, then selection, then the lower bounds, then sorting at a scale where the cost model changes.
Searching and sorting, analysing iterative algorithms, divide and conquer, recursion trees and amortised analysis, expected value, linearity of expectation and permutations, all from discrete mathematics; and priority queues and binary heaps, and building a heap in linear time, from the data structures course on this path.
Read the pivot rule as a claim about inputs. Every deterministic rule has a bad input and the lab will build it; randomisation moves the randomness from the data to the algorithm, which is the whole distinction of “Randomised Quicksort”.
Count before you classify. A sort that is Θ(n + k) is linear only for the k you actually have, and the lab plots both terms.
Play the adversary. “Adversary Arguments” is the one place on this path where the reader is asked to defeat an algorithm rather than run one.
Sorting networks and parallel sorts. The cost model here is sequential.
Shellsort, and Timsort's run-merging policy. Timsort's shape — runs, then merges, with insertion sort below a cutoff — is in “k-Way Merging and Sorting in Practice”; its galloping and run-stack rules are not.
Cache-oblivious analysis, and sorting linked lists.