UGC-NET | UGC NET CS 2016 Aug – III | Question 32
Consider a hash table of size m = 10000, and the hash function h(K) = floor (m(KA mod 1)) for A = ( √(5) – 1)/2. The key 123456 is mapped to location ______.
(A) 46
(B) 41
(C) 43
(D) 48
Answer: (B)
Explanation: Given hash function: h(K) = floor (m (K*A mod 1))
where A = ( √(5) – 1)/2
h(123456) = floor(10000 * (123456 * (√5 − 1) / 2) mod 1) = floor(10000 * (76300.004115 mod 1) = floor(10000 * (.004115)) = 41.15 = 41
So, option (B) is correct.
Quiz of this Question