Intermediate · 20 minYou are hereRead
Hash functions
A hash function turns a key into an array index, spreading keys evenly so most lookups go straight to the right place. Collisions are certain; spreading is what matters.
Sorting and hashing
Intermediate · 20 minYou are hereRead
A hash function turns a key into an array index, spreading keys evenly so most lookups go straight to the right place. Collisions are certain; spreading is what matters.
Intermediate · 20 minYou are hereRead
Each bucket holds a linked list of the keys that hash there, so with load factor α a lookup checks about α keys.
Intermediate · 20 minYou are hereRead
Keep every key in the array itself; after a collision try the next slot, and the next, until one is free.
Intermediate · 15 minYou are hereRead
Probing 1, 4, 9, … slots away breaks up linear probing’s long runs, though keys with the same home still follow the same path.
Intermediate · 15 minYou are hereRead
Taking the probe step from a second hash gives each key its own stride, so keys that collide once go separate ways.
Intermediate · 15 minYou are hereRead
When the load factor passes a limit, the table doubles its buckets and re-inserts every key, at an average cost per insertion that stays constant.
Related topics