Week 109 of 145 ยท TAOCP Vol 3: Sorting and Searching

TAOCP 6.2.1 Searching an Ordered Table

1 task, 3 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 binary search and its probe sequence on a small sorted table.
  • Explain when interpolation search beats binary search and when it fails.
  • Implement binary search and test it exhaustively on small arrays.

Week 109 ยท Self-check

Three quick questions

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

  1. Binary search with midpoint โŒŠ(l + u)/2โŒ‹ looks for 23 in 3 7 11 15 19 23 27. Which keys does it compare against?
  2. Which data suits interpolation search best?
  3. Which midpoint calculation avoids integer overflow for huge arrays?

Nothing is saved while signed out.

Discussion

0 posts

Stuck on week 109, 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