+1 vote
in Data Structures & Algorithms I by (88.2k points)
What is a hash function?

(a) A function has allocated memory to keys

(b) A function that computes the location of the key in the array

(c) A function that creates an array

(d) A function that computes the location of the values in the array

The origin of the question is Hash Tables in portion Hash Tables of Data Structures & Algorithms I

This question was addressed to me during an interview.

1 Answer

+1 vote
by (737k points)
selected by
 
Best answer
Right choice is (b) A function that computes the location of the key in the array

Easy explanation - In a hash table, there are fewer array positions than the keys, so the position of the key in the array has to be computed, this is done using the hash function.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...