15.3. Resolving collisionsΒΆ

Since we know that perfect hash functions are not generally possible except in limited cases, we must assume that sometimes a hash function will generate the same value for two different objects.

For example, in our simple hash table example, if we need to add another value that collides with an existing entry, then how can we store it?

Simple hash table

There are two general approaches:

Historically, one of the most common approaches to dealing with collisions has been to use fixed size buckets, for example an array that can hold up to k (some small constant) elements. The problem with this approach is if we get more than \(k\) collisions at the same location, then we still need to fall back to some other technique.


You have attempted of activities on this page