Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Open Addressing from Scratch

โญโญโญ advancedโณ 16 min read๐Ÿ“ Lesson 171 of 225

Hash tables without chaining: probing, load factor, tombstones, and why memory layout decides cache fate.

One array, no pointers per entry

Chaining stores a linked list per bucket โ€” pointer-chasing that misses cache on every step. Open addressing keeps all entries in one array: on collision, probe the next slot (linear probing), until an empty one appears.

The load factor governs everything

alpha = used / capacity. As alpha approaches 1, probe runs get long; the standard discipline is to resize (rehash into a bigger table) at alpha ~ 0.7. Amortized insert stays O(1) โ€” the occasional rehash is paid for by many cheap inserts.

Deletion needs tombstones

An empty slot ends a probe run โ€” so simply emptying a deleted slot breaks lookups for entries that probed past it. The fix: mark deletions with a tombstone state that probes continue through. Tombstones accumulate; periodic rehash cleans them.

Layout is performance

One array of entries is cache-friendly: a probe is a linear scan. This is why fast hash tables (and this whole course) treat memory layout as part of the data-structure design, not an afterthought.

โšก Now practice

Ready to Code
Data Structure Build DrillsHash table, heap, and union-find โ€” each built over explicit arrays with pin-downable contracts.
4 challenges ยท ยท ~26 min