TAOCP Vol 3: Sorting and Searching · Week 83

TAOCP 5.3.2 Minimum-Comparison Merging: reading guide

About the book

The fewest comparisons needed to merge two sorted lists of given sizes, with adversary arguments and a binary merging algorithm for unequal sizes (Hwang-Lin).

Time About 5 hours this week

Why it matters

Merging very unequal lists efficiently is useful for set intersection in search engines and databases. Adversary arguments are a powerful proof tool.

Before you start

  • 5.3.1 Minimum-Comparison Sorting

How to approach it

Focus on the adversary argument idea and on the binary merge algorithm. Implement binary merging and compare against linear merge when one list is tiny.

Exercises

Do every exercise rated 00 to 20 in your head or on paper; they are quick and they check you actually absorbed the definitions. Then pick two or three rated 20 to 25 (M or not) and grind them out fully. Attempt one M25 to M30 and give yourself a hard 90-minute cap before reading the answer. Always read the answer to every exercise you attempted, even the ones you got, because Knuth's answers often teach a second technique.

Links

Back to week 83