Chaining is a technique used for avoiding collisions in hash tables.
A collision occurs when two keys are hashed to the same index in a hash table. Collisions are a problem because every slot in a hash table is supposed to store a single element.
In the chaining approach, the hash table is an array of linked lists i.e., each index has its own linked list.
All key-value pairs mapping to the same index will be stored in the linked list of that index.
Through chaining, insertion in a hash table always occurs in O(1) since linked lists allow insertion in constant time.
Theoretically, a chained hash table can grow infinitely as long as there is enough space.
A hash table which uses chaining will never need to be resized.
Free Resources