#separator:tab
#html:true
#notetype:Basic
#tags column:3
#deck:cracked.guide::Crafting Interpreters::Ch 20 Hash Tables
#columns:Front	Back	Tags
Crafting Interpreters ch 20, Hash Tables: what does it cover?	A hash table from scratch with open addressing and linear probing, FNV-1a hashing, tombstones for deletion, growth by load factor, and string interning so string equality becomes pointer equality.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::about
Crafting Interpreters ch 20, Hash Tables: why does it matter?	Hash tables are the most used data structure in practice. Building one yourself demystifies every dictionary and map you use, and Knuth 6.4 later analyzes exactly this design.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::why
Crafting Interpreters ch 20, Hash Tables: which part of the book is it in?	clox (bytecode VM, C)	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::part
String interning: what is it?	String interning stores exactly one copy of each distinct string value, so two equal strings are always the same object and can be compared by address.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::definition
String interning: Do real languages intern strings?	Many do for identifiers and literals, and some intern all strings. Java interns string literals, for example, and exposes intern() for others.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::definition
Open addressing: what is it?	Open addressing is a hash table collision strategy in which every entry lives in the table's own array, and a collision is resolved by probing other slots until a free one is found.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::definition
Open addressing: Open addressing or chaining?	Open addressing is cache friendly and avoids allocations; chaining tolerates high load factors and simpler deletes. Knuth's §6.4 compares them with exact numbers.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::definition
Crafting Interpreters ch 20: what traps should you watch for?	<ul><li>Not treating tombstones correctly on insert versus lookup.</li><li>Infinite loop when the table has no empty slots (load factor too high).</li><li>Counting tombstones in the load factor or not, inconsistently.</li></ul>	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::traps
Crafting Interpreters ch 20: which end-of-chapter challenges are worth your time?	Challenge 1 (support non-string keys) and challenge 2 (tune and compare hash table designs) are great; challenge 3 (benchmarking) pairs well with 2.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::challenges
Crafting Interpreters ch 20, Hash Tables: how should you work through it?	Implement, then write a small stress test that inserts and deletes many keys and checks lookups. Re-read the tombstone section twice; it is the subtle part.	cracked.guide cracked.guide::phase::interpreters cracked.guide::chapter::20 cracked.guide::kind::approach
