Skip to content
Related Articles
Open in App
Not now

Related Articles

UGC-NET | NTA UGC NET 2019 June – II | Question 24

Improve Article
Save Article
  • Last Updated : 03 Dec, 2021
Improve Article
Save Article

Consider double hashing of the form
h(k,i)=(h​ 1​ (k)+ih​ 2​ (k)) mod m
Where h​ 1​ (k)=k mod m
h​ 2​ (k)=1+(k mod n)
Where n=m-1and m=701
for k=123456, what is the difference between first and second probes in terms of slots?
(A) 255
(B) 256
(C) 257
(D) 258


Answer: (C)

Explanation: Given that

=> h(k, i) = (h1(k)+ih2 (k)) mod m
=> Where h​1​(k)=k mod m,
h​2​ (k)=1+(k mod n)
n=m-1,
m=701
k = 123456

Now,

=> h1(k) = 123456 mod 701 = 80
=> h2(k) = 1 + (123456 mod 700) = 1 + 256 = 257

1st probe: when i =1

=> h(k, i) = h1(k) + ih2(k)
=> h(k, 1) = h1(k) + h2(k) = 80 + 257 = 337

2nd probe: when i =2

=> h(k,2) = h1(k) + 2*h2(k)
= 80 + 2*257

=> h(k,2) = 80 + 514 = 594

So, difference between first two probes = 594 – 337
= 257
=> Option C is answer.

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

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!