Key components of linear probing


Now that we know what linear probing is, let's look at the structure of a hash table implemented using linear probing. The hash table is just an encapsulation around an array that stores key-value pairs. Different pieces have to be put together to create a hash table. Let's look at all the components and functions needed to implement a hash table using linear probing.

Record

Unlike separate chaining, in a linear probing implementation of a hash table, each index in the internal array stores only one record, and collisions are handled by finding the next available free slot. For this reason, we store the key-value mapping and additional metadata to identify the type of slot (empty, deleted, or occupied) at each index in the array.

Liking the course? Check our discounted plans to continue learning.