Question: 3. Hash Table (25 pts:8+10+7) a) You are given a hash table of initial capacity 5 to store integer keys. Since the keys are integers,


3. Hash Table (25 pts:8+10+7) a) You are given a hash table of initial capacity 5 to store integer keys. Since the keys are integers, the hash code is the integer itself, and the integer is directly mapped to the table using key mod table.capacity. Create the smallest dataset of distinct non-negative integer keys that will be inserted in the hash table so that, after inserting all the integers in the dataset, the average number of comparisons for successful search is less than 3. and the worst case number of comparisons is 6. Show the hashtable with all your dataset integers in it, no need to show vatues. (Assume thatthe load factor threshold is large enough that no rehashing will happen.) mod 5 1o, 1S, 26, 2s, 3o,3 ->0 | 11,12,13,14 leatase b) Create a different dataset starting with the requirements of (a), plus the additional requirements sh. Show the threshold is 2, and your da taset must force exactly one reha that the load factor final hashtable (after all entries have been added) with your dataset integers in it. (Assume that a rehash doubles the capacity of the table ) 15
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
