edited by
4,274 views
5 votes
5 votes

How many probes takes place to insert a sequence of numbers: 14, 17, 25, 37, 34, 16, 26, into a hash table of size 11, using Double hashing, where h(x) = x mod 11, h2(x) = x mod 7 + 1 ?

I am getting collision even after using h2(x) for 16

Please somebody can explain it?

Given solution :

edited by

2 Answers

0 votes
0 votes
Solution Given is absolutely Correct. Please use the Double hashing technique properly . FIrst of all try with h(x)%11 , if collision occour then use the double hashing technique which is (h(x)+ i*h2(x)%7+1)%11, here i is the iteration number.
0 votes
0 votes
( a + b) % c = ( ( a % c ) + ( b % c ) ) % c

Is the property required.

HASH(X) = (HASH(X) + I $\times$ (HASH2(X) + 1)) % S

A. 14 MOD 11 = 3

 B.17 MOD 11 = 6

C. 25 MOD 11 = 3. 3 is not free. (3%11+((25 MOD7)+1)%11)%11 = 8

D.37 mod 11 = 4

E. 34 mod 11 = 1

F. 16 mod 11 = 5

G.26 mod 11 = 4. 4 is not free. (4%11+(26%7+1)%11)%11= 10

C and G take 2 probes rest takes 1. So 9 is total

Related questions

0 votes
0 votes
2 answers
1
altamash asked Nov 5, 2018
2,549 views
can any one explain double hashing example
0 votes
0 votes
1 answer
2
0 votes
0 votes
0 answers
3
rsansiya111 asked Mar 12, 2022
360 views
Canadian postal codes have the format LDL DLD, where L is always a letter (between A-Z), D is always a digit (0-9), and is always a single space. For example, the postal ...