Let n be the number of elements in a hash table of m slots, which uses
open addressing.
Expected insertion time is
. The
graph looks like this for m = 1000:
This means that we can expect really fast insertion as long as the
table is less than about 90 % full. At 90 % full, an insertion is
expected to require 10 probes. This increases quickly as the table
fills even more.
Let
be the probability that exactly i slots are
found to be occupied before an empty slot is found (
for
).
Let
be the number of probes.
Then
.
Let
be the probability that at least i
slots are found to be occupied. Note that
,
since
is the probability that at least i, but not
i+1 slots are found to be occupied. Then
The first probe has an
chance of hitting an occupied
slot, assuming simple uniform hashing, so
If the first slot is occupied, then
of the remaining
slots
are occupied, and
In general,
Thus
So the expected number of probes in an unsuccessful search is
.