Definition · Open addressingEvery key is stored in a slot of the table itself; there are no chains. A key k has a probe sequence h(k, 0), h(k, 1), … covering all m slots. Insert walks it to the first free slot. Search walks it and stops when it finds k or reaches an empty slot. Since every key occupies a slot, n ≤ m and so α ≤ 1.
Linear probing is h(k, i) = (h(k) + i) mod m: try the next slot, and the next. Double hashing uses a second hash function for the step, which breaks up the runs.
The lab offers only power-of-two table sizes, and the reason is worth knowing: the double-hashing step it computes is always odd, and an odd step is coprime with m — so the probe sequence reaches every slot — exactly when m is a power of two. At m = 13 a step could share a factor with the table size and the sequence would miss slots, which is a silently broken table rather than a slow one.
Deletion, and the keys that disappear
Search stops at the first empty slot. So consider a key k whose probe sequence is 5, 6, 7 and which ended up in slot 7 because 5 and 6 were taken. Delete the key in slot 6 by emptying it, and now a search for k probes slot 5, probes slot 6, finds it empty, and reports that k is not in the table. k is in slot 7. It will never be found again.
Definition · TombstoneA slot may be empty, occupied, or dead — a tombstone left by a deletion. A search treats a dead slot as occupied by something else and keeps going; an insertion treats it as free and may reuse it. Only an empty slot stops a search.
The cost is that tombstones accumulate: they lengthen searches without holding keys, so a table with many deletions eventually needs rebuilding even though its load factor looks healthy.
Example · Three keys, lost and recoveredThe lab fills a table of 32 slots with 22 keys, deletes eight of them and then searches for the fourteen that remain. With tombstones, all fourteen are found. Deleting by emptying the slot instead loses three of them, and the panel prints their keys. Nothing about the table looks wrong: the load factor is right, the slots are consistent, and three records are gone.
Clustering, and a number that is a model rather than a count
Now the cost. A table of 32 slots aimed at seven tenths full ends up with 22 keys, so α = 11/16 = 0.6875. The lab then searches for twelve keys that are not present and for all 22 that are, counting probes, and prints the standard curves beside the counts:
m = 32, linear probing, n = 22 α = 11/16 = 0.6875
counted Knuth's curve (approximate)
unsuccessful search 5.000 5.62
successful search 2.318 2.10
longest run of non-empty slots 12 of 32
clusters 1 2 12 1 1 5
Those two right-hand numbers are the one approximation this lesson prints, and what is approximate is the model, not the arithmetic. Knuth’s curves assume a uniform hash function and the idealised distribution of cluster lengths the analysis derives, and this library proves neither. The numbers beside them were produced by walking 32 slots and incrementing a counter. The lab labels the column, and the reason to keep the two apart is visible one row down the load curve.
m = 32, linear probing, same keys, aimed at nine tenths n = 28
α = 7/8 = 0.875 counted 8.417 probes unsuccessful
Knuth's curve 32.50
the curve is above the table's own ceiling: a 32-slot table
cannot cost more than 32 probes, because there are only 32 slots
At α = 7/8 the curve says 32.5 and the table counted 8.4. Neither number is wrong. The curve describes a table large enough for the idealised cluster distribution to hold; a 32-slot table at α = 7/8 has four empty slots, and an unsuccessful search stops at one of them after about eight probes. The curve is asymptotic in m as well as in the load, and the lab prints the difference in its own column so the parting of the two is on the page rather than in a footnote.
Above α = 0.98 the lab refuses to print the curve at all, and says so where the number would have been. The reason is that the curve is effectively vertical there: 1/(1−α)² is 2500 at α = 0.98 and 10 000 at 0.99, so a figure read off it is a statement about the formula rather than about any table. That refusal is the honest behaviour for a model outside its range, and it is why α in a probing table is kept well below 1 — at α = 1 there is no empty slot left to stop any search at all.