Cuckoo Hashing and Slot Assignment
Interpret two-choice hashing as orienting edges toward storage slots and explain why insertion may require rebuilding.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Assign each key to one of two positions
In the two-table variant, each key has one possible slot in either table. Think of slots as vertices and keys as edges joining their two candidates. Storing a key means choosing one endpoint, and each vertex may receive at most one edge. A connected component with more edges than vertices is impossible to assign. Conversely, a tree can assign each edge to its child relative to a chosen root. A component with one cycle assigns around the cycle and then outward along its trees.
Lookup stays small while insertion may move many keys
A lookup checks both candidate locations. Insertion can occupy a candidate and move its displaced key to its alternative, continuing across the component. An excessive displacement chain can trigger construction with fresh hash seeds or a larger table. Useful performance bounds depend on load and the randomness model, as with universal hashing. This contrasts with the variable lookup lengths of linear probing.[1]