Trying to insert an element into a hash table at an index already occupied, causes _______.
Trying to insert an element into a hash table at an index already occupied, causes _______.
Solution
A collision occurs when two different keys hash to the same index in a hash table. Since that slot is already occupied, the new element cannot be placed there directly and needs a collision resolution method.
Common methods are chaining (store a linked list at each index) and open addressing (probe for another free slot, e.g. linear probing).
Option 2: overwriting happens only if the table is designed to replace the old value, or when the same key is inserted again. It is not the standard term for two keys mapping to one index.
Related questions:
2025: 22 May Shift 1
2025: 30 May Shift 2
2025: 3 June Shift 2
2026: 13 May Shift 2
2025: 20 May Shift 1