TAOCP Vol 3: Sorting and Searching · Week 115
TAOCP 6.4 Hashing (part 2)
Updated
Summary
TAOCP 6.4 Hashing (part 2) covers the rest of the section (pages 533 to 549): deleting from open-addressed tables without breaking later searches, the starred analysis of expected probe counts for chaining, and more. Budget about 9 hours; do exercises 21, 65 and 42.
Part 2 covers the rest of the section (pages 533 to 549): deleting from open-addressed tables without breaking later searches, the starred analysis of expected probe counts for chaining, linear probing and double hashing as the table fills, hashing on external storage with buckets, a comparison of all the methods, and history.
See it
All visualsStep through at your own pace; the arrow keys work too.
- 0empty
- 1kiwihome
- 2empty
- 3empty
- 4empty
- 5tombstone
- 6fighome 5
- 7applehome
Slot 6 holds "fig": found, because probing went on past the tombstone at slot 5.
This week's steps
3 stepsRead §6.4 Hashing (part 2)
Compare this with your clox hash table from chapter 20: tombstones, load factor, linear probing.
Start with Ex 21, Ex 65, Ex 42; 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
Section 6.4 has 78 exercises (one set for both weeks), rated 10 to M49, and Knuth marks 15 of them with the triangle for recommended. This week covers pages 533 to 549: deletions, the analysis of the algorithms, external searching, the comparison of methods and the history. The matching exercises are 21 to 65 and 67 to 71 (50 exercises, 8 recommended: 21, 23, 33, 34, 37, 42, 48, 65). Most are M or HM analysis; pick a few rather than grinding through. 57, 60 and 62 are open, and many in the 40s are research-level.
Worth your time
Exercise 2333▶ Recommended
Design deletion for coalesced chaining, analogous to linear-probing deletion.
Exercise 37M29▶ Recommended
Variance of successful search cost under separate chaining. The stretch.
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 2120No 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 2333No 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 29M21No 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 33M23No 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 34M23No 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 37M29No 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 42M20No 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 6520No 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
Open addressing with linear probing is what many modern high-performance hash tables use. Knuth's linear probing analysis is historically the start of the field of algorithm analysis.
Before you start
- 6.4 Hashing (part 1)
How to approach it
Compare this with your clox hash table from chapter 20: tombstones, load factor, linear probing. Measure probe counts at load factors 0.5, 0.75 and 0.9 and compare to Knuth's formulas.
Common traps
- Deleting by just clearing a slot breaks later searches. Tombstones or Knuth's deletion algorithm fix this.
- Letting the load factor get close to 1 with linear probing.