#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::TAOCP Vol 3::6.4 Hashing (part 1)
#columns:Front	Back	Tags
TAOCP §6.4 Hashing (part 1): what does it cover?	Part 1 covers the first part of the section (pages 513 to 533): choosing hash functions (division, multiplicative and Fibonacci hashing, and the idea of universal families), collision resolution by chaining, including coalesced chaining in a single table, and open addressing with linear probing and double hashing, ending with Brent's variation.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::about
TAOCP §6.4 (part 1): why does it matter?	Hash tables are the most used data structure in practice. Knowing why a bad hash function wrecks performance will save you in production.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::why
TAOCP §6.4 (part 1): what traps should you watch for?	<ul><li>Using a power-of-two table size with a weak hash: only low bits get used.</li></ul>	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::traps
TAOCP §6.4 (part 1), exercise 6 (rated 15): what is it asking?	Judge a shortcut at the start of the division hashing code.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::exercise
TAOCP §6.4 (part 1), exercise 15 (rated 16): what is it asking?	Why open addressing should report overflow one slot early.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::exercise
TAOCP §6.4 (part 1), exercise 12 (rated 21, recommended): what is it asking?	Tighten the chained hashing inner loop to one conditional jump.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::exercise
TAOCP §6.4 (part 1), exercise 18 (rated 21, recommended): what is it asking?	Compare two ways of computing the double hashing step.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::exercise
TAOCP §6.4 (part 1), exercise 13 (rated 24, recommended): what is it asking?	Store only part of each key in a chained table, since the bucket implies the rest.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::exercise
TAOCP §6.4 (part 1), exercise 66 (rated 25, recommended): what is it asking?	Keep keys ordered within probe sequences so failed searches stop early.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::exercise
TAOCP §6.4 (part 1), exercise 76 (rated M21, recommended): what is it asking?	Extend a universal hash family to variable-length keys.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::exercise
TAOCP §6.4 (part 1), exercise 72 (rated M28, recommended): what is it asking?	Universal hashing: why a randomly chosen function from a good family keeps chains short. The stretch.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::exercise
TAOCP §6.4 (part 1): how many exercises, and how are they rated?	78 exercises, rated 10 to M49.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::exercises
TAOCP §6.4 (part 1): what should you be comfortable with first?	<ul><li>6.1 to 6.3</li><li>1.2.4 Number theory</li></ul>	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::prereqs
TAOCP §6.4 (part 1): how should you work through it?	Implement multiplicative hashing and test it against keys with patterns (all multiples of 64, sequential IDs). Implement a chained hash table and measure chain lengths against the theoretical averages.	cracked.guide cracked.guide::phase::taocp-3 cracked.guide::section::6.4 cracked.guide::kind::approach
