The following keys 22, 28, 23, 12 and 13 are inserted into initially empty hash table of length 9 using open addressing with hash function h(k) = k mod 9…
The following keys 22, 28, 23, 12 and 13 are inserted into initially empty hash table of length 9 using open addressing with hash function h(k) = k mod 9 and linear probing. At what index key 13 is inserted?
Show answerHide answer
Correct answer: (C) 6
Explanation
22→4, 28→1, 23→5, 12→3. 13 mod 9 = 4 is taken, so linear probing tries 5 (taken), then 6, which is free. So 13 goes to index 6.