Tuesday 19 May 2015

Q26,paper 2, D 12. A hash function f defined as f (key) = key mod 13, with linear probing is used to insert keys 55, 58, 68, 91, 27,145. What will be the location of 79 ?


(A) 1
(B) 2
(C) 3
(D) 5
Answer(d).
Explanation. 55 mod13 is 3. 3 rd slot is given to 55.Occupied slot is(3)
58 mod 13 is 6 . 6th slot is given to 58.Ocuppied slots are (3,6)
68 mod 13 is 3 . which is preoccupied hence next free slot 4 is allotted. Occupied slots are (3,4,6).
91 mod 13 is 0. 0th slot is given to 91. Occupied slots are (0,3,4,6)
27 mod 13 is 1. 1st slot is given to 27. Occupied slots are (0,1,3,4,6)
145 mod 13 is 2. 2nd slot is given to 145. Occupied slots are (0,1,2,3,4,6)
79 mod 13 is 1. 1st slot is already occupied and searches for the next free slot, that is 5. 5 th slot is allotted to 79

1 comment:

Note: only a member of this blog may post a comment.