Open addressing

The collision resolution mechanism we used in our example was linear probing, which is an example of an open addressing strategy. Linear probing is simple since we use a fixed number of slots. There are other open addressing strategies as well, however, they all share the idea that there is an array of slots. When we want to insert a key, we check whether the slot already has an item or not. If it does, we look for the next available slot.

If we have a hash table that contains 256 slots, then 256 is the maximum number of elements in that hash. Moreover, as the load factor increases, it will take longer to find the insertion point for the new element. 

Because of these limitations, we may prefer to use a different strategy to resolve collisions, such as chaining.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset