Sorting-and-Searching

Question 1

A hash table contains 10 buckets and uses linear probing to resolve collisions. The key values are integers and the hash function used is key % 10. If the values 43, 165, 62, 123, 142 are inserted in the table, in what location would the key value 142 be inserted?

A
2
B
3
C
4
D
6
       Algorithms       Sorting-and-Searching       Gate 2005-IT
Question 1 Explanation: 
43%10 = 3 [occupy 3]
165%10 = 5 [occupy 5]
62%10 = 2 [occupy 2]
123%10 = 3 [3 already occupied, so occupies 4]
142%10 = 2 [2, 3, 4, 5 are occupied, so it occupies 6]
There is 1 question to complete.
PHP Code Snippets Powered By : XYZScripts.com