Topic guide

Why does merge sort scale differently from insertion sort?

Start with Lecture 3: Insertion Sort, Merge Sort

Watch the recursion tree take shape. The amount of work at a single level and the number of levels answer different counting questions.

Try it

Sort eight cards by merging pairs, then groups of four, then groups of eight. Record comparisons at each level. Predict how adding eight more cards changes the depth and the work per level.

Check your reasoning

A balanced merge tree for eight inputs has three merge levels. Doubling the input adds one level while doubling the number of items moving through each full level. This accounting explains the product of a linear and a logarithmic factor.

Continue with Lecture 4: Heaps and Heap Sort

Heap sort organises comparisons around a priority queue. Compare the operations it repeats with those in your merge tree.

Teaching and evidence

Add to a playlist