search
Log In
2 votes
1.5k views

Consider double hashing of the form

$h(k,i)=(h_1(k)+ih_2(k)) \text{mod m}$ where $h_{1}(k) = \text{k mod m} \ , \ \ h_{2}(k)=1+(\text{k mod n})$ where $n=m-1$ and $m=701$. For $k=123456$, what is the difference between first and second probes in terms of slots?

  1. $255$
  2. $256$
  3. $257$
  4. $258$
in Algorithms
edited by
1.5k views

2 Answers

2 votes

Option c is right. 

0

For calculating first and second probes it should be 
1st Probe – (80+0*257) mod 701 = 80
2nd Probe – (80+1*257) mod 701 = 337
Thus making 337-80 = 257
No idea why have you written 256 in place of 257, I guess there was a mistake done by you though your answer was right….😅

0 votes

3rd is the correct answer .

1st time key will go to 80th slot , 2nd time key will go to 337th slot

DIFFERENCE =337-80 = 257th slot

 

Answer:

Related questions

2 votes
2 answers
1
804 views
Match List-I with List-II: ... (c)-(i); (d)-(ii) (a) - (ii); (b)-(i); (c)-(iv); (d)-(iii) (a) - (iii); (b)-(i); (c)-(iv); (d)-(ii)
asked Jul 2, 2019 in Algorithms Arjun 804 views
3 votes
2 answers
2
1.4k views
There are many sorting algorithms based on comparison. The running time of heapsort algorithm is $O(n \text{lg}n)$. Like $P$, but unlike $Q$, heapsort sorts in place where $(P,Q)$ is equal to Merge sort, Quick sort Quick sort, insertion sort Insertion sort, Quick sort Insertion sort, Merge sort
asked Jul 2, 2019 in Algorithms Arjun 1.4k views
6 votes
2 answers
3
1.2k views
Which of the following is best running time to sort $n$ integers in the range $0$ to $n^2-1$? $O(\text{lg } n)$ $O(n)$ $O(n\text { lg }n)$ $O(n^2)$
asked Jul 2, 2019 in Algorithms Arjun 1.2k views
1 vote
1 answer
4
834 views
Which of the following is application of depth-first search? Only topological sort Only strongly connected components Both topological sort and strongly connected components Neither topological sort nor strongly connected components
asked Jul 2, 2019 in Algorithms Arjun 834 views
...