Exams › GATE › Technical
Suppose we are given n keys, m hash table slots, and two simple uniform hash functions h1 and h2. Further suppose our hashing scheme uses h1 for the odd keys and h2 for the even keys. What is the expected number of keys in a slot?
- m / n
- n / m
- 2n / m
- n / 2m
Correct answer: n / m
Solution
The expected number of keys in a slot is calculated by dividing the total number of keys (n) by the number of slots (m). Since the hashing functions distribute keys uniformly across the slots, this results in an average of n/m keys per slot.
Related GATE Technical questions
⚔️ Practice GATE Technical free + battle 1v1 →