Question: Part B: Problem 1 : ( 2 5 points ) Assume you are creating a hash table that uses chaining. Recall that the runtime depends
Part B: Problem : points Assume you are creating a hash table that uses chaining. Recall that the runtime depends on the load factor where is the number of inserted items and is the number of slots.
The choice of is important. Too high of an means more collisions. Too low of an means we are wasting space. Let be our lower bound and be our upper bound on so that
Answer the following questions:
a Modify CHAINEDHASHINSERT T x to increase the size of the hash table if exceeds or is equal to You can calculate your lower bound on the size of the table from ie
b Modify CHAINEDHASHDELETE to decrease the size of the hash table if becomes less than or equal to You can calculate your upper bound on the size of the table from ie
c Assume your hash table has elements and the table size is ie and Let and If you insert more items, what are and How many more items do you need to add to the table before changes again? Graph as increases on the interval eg graph as a function of :
d Describe the worst case runtime for CHAINEDHASHINSERTT x Describe the best case? Assuming that the maximum probability of the worst case is informally argue for an average case runtime is
e Theorem states that the averagecase runtime for searching in a hash table with chaining is Using this theorem along with our modifications to delete and insert, prove the following:
Show: Let If then the averagecase runtime of search with chaining is
Hint: What is the asymptotic runtime of
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
