Week 96 of 145 · TAOCP Vol 3: Sorting and Searching

TAOCP 5.2.3 Sorting by Selection

2 tasks, 4 steps. Open a task's steps to see exactly what to do; each guide has the detail.

Sign up or sign in to tick these off and give this week a due date.

By the end of this week you can

  • Trace heap construction and the sift-down step of heapsort.
  • Implement a priority queue with insert and delete-min on an array heap.
  • Compare straight selection, tree selection and heapsort by comparisons used.

Week 96 · Self-check

Three quick questions

Ungraded, and it never holds anything up. Pick an answer to see why.

  1. Build a max-heap bottom-up (sift down from the last parent to the root) from 3 1 4 1 5 9 2 6. What is the array?
  2. In a heap stored in a 0-based array, where are the children of position i?
  3. How many comparisons does straight selection make on 6 keys, whatever their order?

Nothing is saved while signed out.

Watch along

Free talks and lectures that go with this week, on the speakers' own channels. Optional.

Discussion

0 posts

Stuck on week 96, or finished early? Say what you tried and what happened. Hints over answers: full solutions go in a spoiler.

No posts yet. Ask a question or share a tip.

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

Spot a mistake? Report it