Knuth · Weeks 90 to 117
TAOCP Volume 3: Sorting and Searching
The most directly practical volume. Chapter 5 covers sorting: the combinatorics of permutations, every classic internal sort with exact analysis, lower bounds, sorting networks and external sorting. Chapter 6 covers searching: binary search, balanced trees, B-trees, tries, hashing and secondary keys. You will finish it able to read any database or standard library internals. Jonathan Blow put it this way in a clip that helped inspire this path: "If you actually go through [Volume 3] for real, you will know way more data structures than anyone with a CS degree." For real means the exercises too.
Every section, week by week
Each section links to its reading guide: what it covers, how to approach it, exercises picked from the book with their ratings, common traps and links. Picked is how many exercises the guide recommends; time is its budget for the week.
What you will be able to do
- Implement and analyze quicksort, heapsort, merge sort, radix sort and Shellsort.
- Explain why comparison sorting needs about n lg n comparisons.
- Build AVL trees, B-trees, tries and hash tables, and predict their performance.
- Design an external sort for data that does not fit in memory.
Before you start
- Vols 1 and 2, especially 1.2 math and 2.3 trees.
- Your clox hash table (chapter 20) as a reference point for 6.4.
Getting the book
The current edition is the second edition (1998), ISBN 0-201-89685-0.
Vol 3, 2nd edition is about $64 new from InformIT. The 1st edition (1973) is fine and often very cheap used. Borrow before you buy: many public and university libraries give you free access to O'Reilly Learning, which carries TAOCP; Libby/OverDrive and interlibrary loan (search WorldCat) work too. Older used editions are fine for Vols 1 to 3; section numbers barely changed. If you buy the eBook, get the PDF from InformIT. Knuth himself warns that the Kindle and ePUB versions mangle the math.
What you need has every option with prices, and which edition do I need covers the differences.
Tips
- The tape-sorting sections (5.4.2 to 5.4.8) are mostly historical; skim them and spend the time on 5.4.1 and 5.4.9.
- Build one shared benchmark harness for all your sorts.
Questions
How long does TAOCP Volume 3 take?
On the cracked.guide path it takes 28 weeks (weeks 90 to 117), about 6 months, and the reading guides budget about 217 hours in all.
How many exercises are in TAOCP Volume 3?
964 in the sections the path covers, rated 00 to M50, and 217 of them carry Knuth's triangle for recommended. Each reading guide picks the ones worth your time.
Which edition of Volume 3 do I need?
The current one is the second edition (1998). Older used editions work for most of it; section numbers barely changed. Buy the PDF, not Kindle, if you want an eBook.