TAOCP Vol 3: Sorting and Searching · Week 104
TAOCP 5.4.5 The Oscillating Sort
Updated
Summary
TAOCP 5.4.5 The Oscillating Sort: A tape sorting scheme that interleaves run creation and merging so the sort oscillates between phases, reducing tape movement. Budget about 3 hours; do exercises 4, 1 and 5.
This week's steps
3 stepsRead §5.4.5 The Oscillating Sort
Skim.
Start with Ex 4, Ex 1, Ex 5; log what you solve below.
Write down one thing you'd explain to someone
A few sentences in your own words in Your notes: the idea, why it works, an example. 30 words ticks this.
Sign in to track this: tick each step off and it counts toward your week.
Exercises
This section has 5 exercises, rated 21 to 29, and Knuth marks 1 of them with the triangle for recommended. Only five exercises, so do all of them. 3 is the meaty one: chart Algorithm B on a small case and find where it wastes work.
Worth your time
Exercise 329▶ Recommended
Chart Algorithm B on three tapes and nine runs, spot the inefficiency and fix it.
Your log
Sign in to log the exercises you work: number, rating, how far you got.
Your notes
Only youSign in to keep private notes on this guide, in Markdown. They stay yours: never on your profile, and you can export them all.
Discussion
0 postsQuestions about the reading go here; each exercise has its own thread below. Hints over answers.
No posts yet. Ask a question or share a tip.
Sign in to postAnyone can read. Posting needs an account with a confirmed email.
Exercise threads
One thread per exercise. Open one to ask for a nudge or check your thinking.
Exercise 122No posts yet
Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler:
||like this||or a```spoilerblock.Sign in to postAnyone can read. Posting needs an account with a confirmed email.
Exercise 329No posts yet
Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler:
||like this||or a```spoilerblock.Sign in to postAnyone can read. Posting needs an account with a confirmed email.
Exercise 421No posts yet
Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler:
||like this||or a```spoilerblock.Sign in to postAnyone can read. Posting needs an account with a confirmed email.
Exercise 5M25No posts yet
Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler:
||like this||or a```spoilerblock.Sign in to postAnyone can read. Posting needs an account with a confirmed email.
Reference
Why it matters
Honest note: the tape-merging sections describe hardware nobody uses anymore. Knuth himself says much of 5.4 is historical. The ideas (run generation, merge patterns, minimizing passes over slow storage) still apply to external sorting on disks and SSDs, database sort operators and big-data shuffles, so read for those ideas and skim the tape mechanics.
Before you start
- 5.4.4 Reading Tape Backwards
How to approach it
Skim.