GATE | GATE CS 2020 | Question 33

Consider a double hashing scheme in which the primary hash function is h1(k) = k mod 23, and the secondary hash function is h2(k) = 1+(k mod 19). 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 k = 90 is ________ .

Note – This question was Numerical Type.
(A) 13
(B) 15
(C) 21
(D) 23


Answer: (A)

Explanation: Given,

Table size = 23,
key value k = 90,
And, probe i = 1 (probe 1 in the probe sequence) 

According to double hashing, we use the formula as,

(h1(k) + i*h1(k)) mod (table size) 

where i denotes probe value.

Now,

h1(k) = k mod 23 = 90 mod 23 = 21

And,
h2(k) = 1+(k mod 19) = 1+(90 mod 19) = 15 

Using to double hashing,

= (h1(k) + i*h1(k)) mod (table size)
= (21 + 15) mod 23
= 36 mod 23
= 13 

Option (A) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.