1.

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 arrayThe origin of the question is Hash Tables in portion Hash Tables of Data Structures & Algorithms IThis question was addressed to me during an interview.

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.


Discussion

No Comment Found

Related InterviewSolutions