Consider a hash table of size m = 100 and the hash function h(k) = floor(m(kA mod 1)) for Compute the location to which the key k = 123456 is placed in hash table.
(A)
77
(B)
82
(C)
88
(D)
89
Answer: (C)
Explanation:
h(k) = floor(m(kA mod 1)) M = 100; k = 123456 h(k) = floor(100(123456 * 0.618033 mod 1)) h(k) = floor(100(76189.882048 mod 1)) h(k) = floor(100 * 0.882048) h(k) = floor(88.2048) h(k) = 88. So, option (C) is correct.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Article Tags :
Recommended Articles