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 1: (25 points) Assume you are creating a hash table that uses chaining. Recall that the runtime depends on the load factor =nm, where n is the number of inserted items and m 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 L be our lower bound and H be our upper bound on so that LH.
Answer the following questions:
(a) Modify CHAINED-HASH-INSERT (T, x ) to increase the size of the hash table if exceeds or is equal to H. You can calculate your lower bound on the size of the table from L(i.e.m=nL).
(b) Modify CHAINED-HASH-DELETE (T,x) to decrease the size of the hash table if becomes less than or equal to L. You can calculate your upper bound on the size of the table from H(i.e.m=nH).
(c) Assume your hash table has 70 elements and the table size is 100(i.e.n=70,m=100, and =0.7). Let L=0.375 and H=0.75. If you insert 10 more items, what are n,m, and ? How many more items do you need to add to the table before m changes again? Graph as n increases on the interval 70n2000(e.g. graph as a function of n:(n))
(d) Describe the worst case runtime for CHAINED-HASH-INSERT(T, x)? Describe the best case? Assuming that the maximum probability of the worst case is 1n, informally argue for an average case runtime is (1).
(e) Theorem 11.2 states that the average-case runtime for searching in a hash table with chaining is (1+). Using this theorem along with our modifications to delete and insert, prove the following:
Show: Let L,HinR+, If LH, then the average-case runtime of search with chaining is (1).
(Hint: What is the asymptotic runtime of (n)?)
Part B: Problem 1 : ( 2 5 points ) Assume you are

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!