0
4.7kviews
What is hashing ? What is mean by collision? Using modulo division method insert the following values in a hash table of size 10. Show how many collisions occurred. 99, 33, 23, 44, 56, 43, 19
1 Answer
written 5.5 years ago by | modified 5.5 years ago by |
99 mod 10 is 9. Since it’s vacant, 99 gets stored at position 9.
33 mod 10 is 3. Since it’s vacant, 33 gets stored at position 3.
23 mod 10 is 3. Since 3 is already occupied by 33, 23 gets stored at the next available location, 4. (1 collision)
44 mod 10 is 4. Since 4 is already occupied by 23, 44 gets stored at the next available location, 5. (1 collision)
56 mod 10 is 6. Since it’s vacant, 56 gets stored at position 6.
43 mod 10 is 3. Since 3 is already occupied by 33, 43 gets stored at the next available location, 7. (4 collisions)
19 mod 10 is 9. Since it is already occupied by 99, 19 gets stored at the next available location, 0. (1 collision)