Question
An algorithm has to store several keys generated by an adversary in a hash table. The adversary is malicious who tries to maximize the number of collisions. Let be the number of keys, be the number of slots in the hash table, and .
Which one of the following is the best hashing strategy to counteract the adversary?
Official answer and solution
- Official answer
- C
- From
- Official GATE 2023 answer key
Solution
Recall hashing methods designed to provide worst-case guarantees against an adversarial key generator.
If a fixed hash function is chosen (such as division method or multiplication method), an adversary who knows the algorithm can deliberately choose keys that all hash to the same slot, resulting in search time per operation.
To counteract this, Universal Hashing selects a hash function chosen uniformly at random from a carefully designed family of universal hash functions at runtime. Because the hash function is unknown to the adversary in advance, no fixed set of keys can reliably trigger worst-case collisions, ensuring an expected search time of regardless of the keys chosen.
Option (C)
Assuming the multiplication method protects against adversaries; any deterministic hash function is vulnerable if known.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2023 Computer Science and Information Technology (CS)
- Question
- 20 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.