Exam-style question
Try this first
What is the main purpose of a hash function in a hash table?.
- A.To calculate a location from a key
- B.To arrange values into a hierarchy
- C.To remove the oldest item first
- D.To make a stack dynamic
Answer and explanation
Concise answer
To calculate a location from a key
Why this is correct
A hash function converts a key into a value that can be used to identify a location in a hash table. If two keys produce the same location, the collision must be handled by the implementation.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
