Open addressing
A way to handle collisions without lists: if the bucket is taken, another one in the same array is tried, for example the next, until a free one is found.
Example
With linear probing and 10 buckets, if 3 and 4 are taken, the key 13 is stored in 5.
Test yourself: Open addressing
Hash collisions
With linear probing, if a lookup reaches an ___ bucket, the key isn't in the table.
If the key were there, it would have been stored before that gap. Looking up 23 from bucket 3, if 6 is empty, it stops there.
Hash collisions
Quadratic probing tries 1, 4 and ___ spots away from the original bucket.
They're the squares: 1², 2², 3² = 1, 4, 9. That way it jumps far and doesn't stick to the occupied cluster.
0/2
â–¶ Play