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

TAOCP 6.4 Hashing (part 1)

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

  • Use division and multiplicative hashing and spot keys that defeat them.
  • Trace insertions with linear probing and with double hashing.
  • Explain how chaining, coalesced chaining and open addressing resolve collisions.

Week 114 · Self-check

Three quick questions

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

  1. A table of 7 slots uses h(K) = K mod 7 and linear probing to the next higher slot, wrapping around. You insert 10, 17, 24, 3. Where does 3 land?
  2. Keys are all multiples of 64 and h(K) = K mod 1024. How many of the 1024 slots can ever be used?
  3. Why must the double hashing step size be relatively prime to the table size M?

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 114, 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