Question: Another option for resolving collisions is to use linear probing. Instead of resolving collisions by putting keys into a linked list, linear probing resolves collisions
Another option for resolving collisions is to use linear probing. Instead of resolving collisions by putting keys into a linked list, linear probing resolves collisions by putting keys into empty slots in the hash table. If the slot given by h(k) is occupied, check h(k)+1, h(k)+2, etc., until an empty slot is found. If we reach the end of the table, we wrap around to check slots 0, 1, ..., h(k)-1.
Given input keys {4371, 1323, 6173, 4199, 4344, 9679, 1989} and a hash function h(x) = x mod 10, draw the resulting hash table, if collisions are resolved with linear probing. Assuming there are 10 slots in the table. Make sure you label the indices of your table.
C
Following our pseudocode conventions, write the algorithm for Probing-Hash-Insert(T,x). Remember to deal with the case suggested by 4B.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
