Open In App

GATE | GATE CS 2020 | Question 33

Like Article
Like
Save
Share
Report

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 ________ . 

(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*h2(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 double hashing, 

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

Option (A) is correct. 


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 11 Aug, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads