Linear Probing
On a collision, walk forward one slot at a time until a free one turns up.
Hash Table: Insert that walks past a collision
Slot 1 holds 12, not 45. Walk on to slot 2.
Cost
- Insert
- O(1) expected
- Search
- O(1) expected
- Worst case op
- O(n)
- Space
- O(capacity)
Performance degrades sharply as load factor approaches 1 (primary clustering).
Before this
Leads to
Topics that need this one first.
Taught by the same lesson
Hash Table covers these too, in the same run.