Collision Resolution By Separate Chaining

Collision resolution by Chaining
🔗
Click here to suggest a better video or view suggestions..

In this method, the actual data is stored in a linked list present at the hashed index location. So if two different keys have the same hashed index, both of them will be added to a linked list present at that index. While retrieving the values, we go through each object in the linked list present at the index position and find the correct one. Below is a sample illustration of how a hash table implementing separate chaining looks (source: wikipedia):

In the above example, both “John Smith” and “Sandra Dee” are mapped to the same index “152”. If each index of the array stores only a single object, the data of one person will be overwritten by the other. But instead a linked list is used at position “152” into which the details of both the persons are added.