Question
Consider a double hashing scheme in which the primary hash function is , and the secondary hash function is . Assume that the table size is 23. Then the address returned by probe 1 in the probe sequence (assume that the probe sequence begins at probe 0) for key value is _______.
Official answer and solution
- Official answer
- 13
- From
- Official GATE 2020 answer key
Solution
Evaluate the primary and secondary hash functions and determine the bucket address for probe 1.
In double hashing, the hash probe sequence for a key at probe index is given by:
where , and the sequence starts at probe .
Evaluate the primary and secondary hash values for :
Evaluate the address returned by probe 1 ():
Therefore, the address returned by probe 1 is 13.
13
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2020 Computer Science and Information Technology (CS)
- Question
- 33 of 65, printed as CS Q.23
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.