edited by
9,531 views
11 votes
11 votes

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 $k$ be the number of keys, $m$ be the number of slots in the hash table, and $k>m$.

Which one of the following is the best hashing strategy to counteract the adversary?

  1. Division method, i.e., use the hash function $h(k)=k \bmod m$.
  2. Multiplication method, i.e., use the hash function $h(k)=\lfloor m(k A-\lfloor k A\rfloor)\rfloor$, where $A$ is a carefully chosen constant.
  3. Universal hashing method.
  4. If $k$ is a prime number, use Division method. Otherwise, use Multiplication method.
edited by

3 Answers

10 votes
10 votes

Answer should be using universal hashing as it randomly chooses hashing function from range of function.
Reference:
CLRS 3rd version:chap:11, page no.265

3 votes
3 votes

Universal hashing refers to selecting a hash function at random from a family of hash functions with a certain mathematical property. This guarantees a low number of collisions in expectation, even if the data is chosen by an adversary. It implements uniform hashing.

ANSWER) C

https://en.wikipedia.org/wiki/Universal_hashing

 

0 votes
0 votes

(C.) Universal hashing method ,In universal hashing, at the beginning of the execution, we choose a hash function randomly from a carefully designed family of functions. This guarantees that no single input would result in the worst-case situation. Since the hash functions are random, the behavior would be different for for each execution which would yield average case performance on each input.

Answer:

Related questions

10 votes
10 votes
4 answers
1
admin asked Feb 15, 2023
9,708 views
Let $f$ and $g$ be functions of natural numbers given by $f(n)=n$ and $g(n)=n^{2}.$ Which of the following statements is/are $\text{TRUE}?$$f \in O(g)$$f \in \Omega(g)$$f...
21 votes
21 votes
4 answers
2
admin asked Feb 15, 2023
11,539 views
Consider functions $\textsf{Function_1}$ and $\textsf{Function_2}$ expressed in pseudocode as follows:Function_1 | Function_2 while n 1 do | for i = 1 to 100 * n do for ...