Abstract
Linear Probing is a collision resolution strategy within the Open Addressing (or Closed Hashing) family. When a key’s natural hash index is occupied, the algorithm “probes” the very next sequential slot in the array. This continues until an empty slot is found or the table is determined to be full.
- Category: Open Addressing (Closed Hashing)
- Solves: Collision resolution within the boundaries of the backing array.
- Typical use cases: Fast lookup tables optimizing hardware sequential memory access.
Core Concepts
Open Addressing vs. Closed Hashing
- Open Addressing: The address of a key is not fixed; it is “open” to moving to a different index than its original hash value.
- Closed Hashing: The key must stay “closed” within the physical boundaries of the backing array.
Primary Clustering
The core disadvantage of Linear Probing. As array slots fill up, sequential clumps of adjacent keys form. These clumps are statistically more likely to grow because any key that hashes anywhere inside the clump is forced to step to the end of it, degrading constant-time operations into linear scans.
How It Works
Linear Probing follows a simple deterministic path: if is occupied, try , then , and so on:

Key Idea
Probing sequential slots yields excellent hardware cache locality, but it directly increases the probability of primary clustering as the table load factor scales.
Algorithm Walkthroughs
Insert(k)
Scans linearly through consecutive array cells until an empty slot, a tombstone, or a duplicate key is found.
Algorithm 1 Linear Probing Insertion
procedure InsertLinearProbe()
H()
while do
if then
return
if then
return
if then
ResizeAndRehash()
H()
The Deletion Problem: Lazy Deletion
You cannot simply set a slot to NULL when deleting a key because doing so would break the probe chain for other collided keys positioned further down the sequence.
- Solution (Tombstones): Instead of clearing the slot directly, the index is marked with a special
TOMBSTONEmarker. - Behavior: A
Findoperation treats a tombstone as occupied and continues probing downstream. AnInsertoperation treats a tombstone as empty and can overwrite it with a new key.
Performance Summary
| Feature Parameter | Linear Probing Specification |
|---|---|
| Average Time Complexity | |
| Worst-Case Time Complexity | |
| Cache Locality | Excellent (Contiguous sequential memory access) |
| Main Weakness | Primary Clustering |
| Deletion Strategy | Lazy Deletion via Tombstones |