TAOCP Vol 3: Sorting and Searching · Week 104

TAOCP 5.4.4 Reading Tape Backwards

Updated

About 3 hours26 exercises, rated 07 to M46

Summary

TAOCP 5.4.4 Reading Tape Backwards: Merge patterns that avoid rewinding by reading tapes backward, which flips the order of runs and changes the bookkeeping. Budget about 3 hours; do exercises 6, 1 and 3.

Flashcards 13 cards for Anki and AnkiMobile · all decks

Anki deck.tsv

This week's steps

3 steps
  1. Read §5.4.4 Reading Tape Backwards

    Skim for the idea.

  2. Work the exercises (8 picked)

    Start with Ex 6, Ex 1, Ex 3; log what you solve below.

  3. 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 26 exercises, rated 07 to M46, and Knuth marks 7 of them with the triangle for recommended. The second half of this section (Karp's tree model of merge patterns, fifo and lifo trees) is the lasting idea; do 19 and 20 to see it. 10 and 14 are big projects, and 16 and 26 are research problems.

Worth your time

  • Exercise 117

    How to adapt end-of-run sentinels when reading tapes backward.

    Discuss

  • Exercise 320▶ Recommended

    Show read-backward polyphase ends with an ascending run on the right tape.

    Discuss

  • Exercise 523▶ Recommended

    Redo the polyphase merge-number formulas for reading backward.

    Discuss

  • Exercise 607

    Convert a merge pattern from tree form to vector form.

    Discuss

  • Exercise 1120▶ Recommended

    True or false: backward-reading merges must alternate ascending and descending runs.

    Discuss

  • Exercise 1728▶ Recommended

    Design an initial distribution for read-backward cascade that ends in ascending order. The stretch.

    Discuss

  • Exercise 1922▶ Recommended

    Find a binary tree that is not 3-fifo. Gets you into Karp's model.

    Discuss

  • Exercise 2022▶ Recommended

    State the strongly-fifo condition as a rule about tape labels.

    Discuss

Your log

Sign in to log the exercises you work: number, rating, how far you got.

Your notes

Only you

Sign 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 posts

Questions 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 117No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

    Sign in to postAnyone can read. Posting needs an account with a confirmed email.

  • Exercise 320No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

    Sign in to postAnyone can read. Posting needs an account with a confirmed email.

  • Exercise 523No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

    Sign in to postAnyone can read. Posting needs an account with a confirmed email.

  • Exercise 607No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

    Sign in to postAnyone can read. Posting needs an account with a confirmed email.

  • Exercise 1120No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

    Sign in to postAnyone can read. Posting needs an account with a confirmed email.

  • Exercise 1728No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

    Sign in to postAnyone can read. Posting needs an account with a confirmed email.

  • Exercise 1922No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

    Sign in to postAnyone can read. Posting needs an account with a confirmed email.

  • Exercise 2022No posts yet

    Hints over answers. Say what you tried; put an answer or a full solution inside a spoiler: ||like this|| or a ```spoiler block.

    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.2 The Polyphase Merge
How to approach it

Skim for the idea. Use the spare time on 5.4.1 or on earlier Vol 3 exercises.

Spot a mistake? Report it

Back to week 104