Quiz Entry - updated: 2026.12.01
Insert 18, 41, 22, 44, 59, 32, 31, 73 (in this order) into a table of size 13 with h(x) = x mod 13 and linear probing. Where does each key end up?
41 at 2, 18 at 5, 44 at 6, 59 at 7, 32 at 8, 22 at 9, 31 at 10, 73 at 11.
* 31 and 73 have to walk past a run of occupied cells before they find a free one. *
| Key | h = x mod 13 | Cells tried | Placed at |
|---|---|---|---|
| 18 | 5 | 5 | 5 |
| 41 | 2 | 2 | 2 |
| 22 | 9 | 9 | 9 |
| 44 | 5 | 5, 6 | 6 |
| 59 | 7 | 7 | 7 |
| 32 | 6 | 6, 7, 8 | 8 |
| 31 | 5 | 5, 6, 7, 8, 9, 10 | 10 |
| 73 | 8 | 8, 9, 10, 11 | 11 |
The first four placements are almost free. But every collision extends the block of occupied cells starting at 5, and every later key that hashes anywhere into that block has to walk to its end. By the time 31 arrives the block covers 5 to 9, so it needs six probes even though the table is barely half full.