Robin Hood Hashing and Probe Displacement
Use resident displacement to decide swaps and terminate unsuccessful searches early under a deletion policy that preserves the rule.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Equalize the probe distances during insertion
In linear probing, a key’s displacement is the number of probe steps from its home bucket to its current slot, following the wraparound convention. If a key being inserted has traveled farther than the resident at an occupied slot, swap them and continue inserting the displaced resident. In a table with room, the walk eventually reaches an empty slot. Robin Hood insertion redistributes probe lengths among the keys instead of leaving all accumulated displacement with the most recent insertion.
A search can sometimes stop before an empty slot
If a search has traveled distance \(d\) and finds a key at smaller displacement, a sought key farther along would have taken this slot when inserted. This reasoning uses an invariant preserved by insertion and by a compatible deletion scheme. Backward-shift deletion moves later displaced entries into the hole until a safe boundary. With ordinary tombstones, additional rules are necessary. Compare open addressing for the baseline probe argument and cuckoo hashing for a design with a constant number of candidate positions.[1]