In a double hashing scheme, h1(k) = k mod 11 and h2(k) = 1 + (k mod 7) are the auxiliary hash functions. The size of the hash table is 11. The hash function for the i-th probe in the open address table is h(k, i) = (h1(k) + i * h2(k)) mod 11. The following keys are inserted in the given order: 24, 50, 70, 75, 9, 2. The slot at which key 24 gets stored is ___________ (Answer in integer)
GATE 2025 · Algorithms · Double Hashing · easy
Answer: Key 24 is stored at slot 2.
- Compute primary hash for key 24: h1(24) = 24 mod 11 = 2. The first probe is at slot 2.
- Check if slot 2 is free: Key 24 is the FIRST key to be inserted (the table is completely empty). Slot 2 is free. Insert key 24 at slot 2.