Show what the array of the HashMap would look like after all the items below have been added, assuming the HashMap class uses linear probing to resolve collisions. Assume the array is resized when the current item to be added will make the total number of items greater than or equal to the threshold value. Note that for both questions, you do not need to compute the hashcodes, since I have provided them for you. Therefore, you only need to carry out Step 2, which is translating the hashcodes to valid array indexes. Assume remainder division is used to accomplish this. The challenge of this assignment is to correctly handle all collisions that may result when translating the larger range of hascode values into the smaller range of valid array indexes. For this assignment you will not need to resize the array or re-hash items.
Show what the array of the HashMap would look like after all the items
below have been added, assuming the HashMap class uses linear probing to resolve
collisions. Assume the array is resized when the current item to be added will make the
total number of items greater than or equal to the threshold value.
Note that for both questions, you do not need to compute the hashcodes, since I have
provided them for you. Therefore, you only need to carry out Step 2, which is translating
the hashcodes to valid array indexes. Assume remainder division is used to accomplish this.
The challenge of this assignment is to correctly handle all collisions that may result when
translating the larger range of hascode values into the smaller range of valid array indexes.
For this assignment you will not need to resize the array or re-hash items.
Step by step
Solved in 2 steps