Consider a double hashing scheme in which the primary hash function is h1(k) =…

2025

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

  1. A.

    13

  2. B.

    15

  3. C.

    21

  4. D.

    23

Attempted by 27 students.

Show answer & explanation

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

Explore the full course: Accenture Preparation