19.4 Handling Collisions: Linear Probing and External Chaining

In hashing, a collision occurs when we have multiple elements that have the same index in our array.

There are two common methods to deal with collisions in hash tables:

  1. Linear Probing: Store the colliding keys elsewhere in the array, potentially in the next open array space. This method can be seen with distributed hash tables, which you will see in later computer science courses that you may take.

  2. External Chaining: A simpler solution is to store all the keys with the same hash value together in a collection of their own, such as a LinkedList. This collection of entries sharing a single index is called a bucket.

Last updated