What is a collision in hashing?

Options

  • A. When two keys produce the same hash index
  • B. When a table becomes empty
  • C. When a key is deleted
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. When two keys produce the same hash index

Detailed Explanation

A collision occurs when two or more different keys are mapped to the same hash-table index by a hash function. Since a table position cannot normally hold multiple independent entries without additional handling, collision-resolution techniques are required. Common methods include separate chaining and open addressing. Open addressing includes techniques such as linear probing, quadratic probing, and double hashing. A good hash function attempts to distribute keys uniformly and reduce collisions.