Both tables below have room for exactly 30 keys. The left one has 30 buckets that each hold 1 key. The right one has fewer, bigger buckets, such as 10 buckets of 3. The same keys go into both, using h(key) = key mod (number of buckets).
The key's bucket already holds at least one other key. Fewer buckets means more keys share a bucket, so collisions go up as buckets get bigger.
The key's bucket is already full, so the key does not fit and must be stored somewhere else. With bucket size 1, every collision is an overflow.
How many keys one bucket holds. A bucket of 3 can absorb two collisions before it overflows, so overflows go down as buckets get bigger.
These curves assume each key is equally likely to land in any bucket. The x-axis is the number of keys already in the table, out of 30 spaces, so 15 keys is a load factor of 0.5. The dashed line marks the slider. Hover over a chart to read exact values, or click to move the slider.
Its bucket already has a key in it.
Its bucket is already full.
Somewhere among all the keys inserted so far.
| Bucket size | Buckets | Next key collides | Next key overflows | At least one overflow so far | Expected collisions so far | Expected overflows so far | Simulated: at least one overflow | Simulated: avg overflows |
|---|