Open addressing (linear probing, quadratic probing, double hashing)

rock, electric guitar, powerful, anthem

Listen on 93

Lyrics

[Verse 1]
When your hash table fills and collision strikes hard
Linear probing steps forward, one slot at a guard
Check the next position, then the next in the line
Sequential progression, methodical design
But clustering emerges when the data gets dense
Primary clusters forming, performance gets tense
Each occupied slot makes the problem grow wide
Consecutive blocks where your searches collide

[Chorus]
Open addressing, three ways to explore
Linear steps forward, quadratic jumps more
Double hash shuffles with a secondary key
Probe till you find it or hit vacancy
No chains, no pointers, just slots in array
Different strategies for collision's decay

[Verse 2]
Quadratic probing breaks the linear curse
One squared, four squared, nine squared dispersed
Jump by perfect squares to scatter the load
Avoids primary clusters on the storage road
But secondary clustering still haunts the scene
Same hash values follow identical routine
Load factor matters, keep it under half
Or quadratic probing loses its craft

[Chorus]
Open addressing, three ways to explore
Linear steps forward, quadratic jumps more
Double hash shuffles with a secondary key
Probe till you find it or hit vacancy
No chains, no pointers, just slots in array
Different strategies for collision's decay

[Verse 3]
Double hashing brings a second function alive
First hash finds position, second hash provides stride
Step size varies with each different key
Breaking patterns that other methods can't free
Hash one mod table size, hash two gives the gap
Coprime with table length, avoids the trap
Ultimate distribution when properly designed
No clustering patterns left behind

[Bridge]
Deletion gets tricky in open address space
Can't just remove, might break the chase
Tombstone markers hold the searching path
Or reconstruct table, do the math
Performance degrades as density climbs
Rehashing required at certain times

[Outro]
Three techniques mastered for collision resolution
Linear, quadratic, double hash solution
Each has its moment, each has its cost
Choose the right method, efficiency's not lost

← Chaining | Consistent hashing →