Which of the following is a desirable property of a good hash function?

Options

  • A. Uniform distribution of keys
  • B. Always producing the same index for every key
  • C. Increasing the number of collisions
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. Uniform distribution of keys

Detailed Explanation

A good hash function should distribute keys as uniformly as possible across the available table positions. Uniform distribution reduces collisions and helps maintain the expected O(1) average performance of hash-table operations. A deterministic hash function must also produce the same hash value for the same key during a given execution. The function should be computationally efficient because hashing is performed during operations such as insertion, searching, and deletion.