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 I) for key value k = 90 is ______.
Correct Answer:
13
Solution:
For double hashing:
Probe sequence = (h1(k) + ih2(k)) mod m
where m is the hash table size and i is the index in the probe sequence.
Given: at i = 1,
h1(k)=k mod 23
h2(k) = 1 + (k mod 19)
Probe sequence =(h1(90) + ih2(90)) mod 23
=((90 mod 23) + 1×(1 + 90 mod 19)) mod 23
=(21 + 1 + 14) mod 23
=36 mod 23
=13