What is the purpose of a Hash Function in a Hash Table?

2024

What is the purpose of a Hash Function in a Hash Table?

  1. A.

    It is used to store keys

  2. B.

    It is used to compute an index into an array of buckets, to which the desired value is then appended

  3. C.

    It is used to compare keys for equality

  4. D.

    None of the above

Attempted by 193 students.

Show answer & explanation

Correct answer: B

The purpose of a hash function in a hash table is to compute an index into an array of buckets or slots, from which the desired value can be found.

Explore the full course: Cocubes Preparation