Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Assume a Hash table has 9 slots and the hash function h(k) = k mod 9 is used to hash keys 6, 17, 16,
2. Assume a Hash table has 9 slots and the hash function h(k) = k mod 9 is used to hash keys 6, 17, 16, 7 and 10 in the table. We use collision resolution by open addressing. The function for collision resolution is h'(k, i) = (h(k)+i) mod 9 for i E {1, 2, ..., m-1}. Note that for the first collision i = 1, for the 2nd collision i = 2 etc. (a) Show the hash table obtained after inserting all 5 keys. (b) Under the assumption of simple uniform hashing, calculate expected number of steps a successful search takes. To answer this question, you have to find the number of probes for each key in the table. Then you add these values and average them. (c) Under the assumption of simple uniform hashing, calculate expected number of steps an unsuc- cessful search takes. To answer this question you don't need a key. Why? Because the key could be anything other than those in the table and there are too many keys to consider. Then how would you solve this problem? You have to look at each location of the table and determine if a probe is made at that location, how many comparison(s) are necessary to determine that the key is not at that location. Do this for all table locations, add the numbers and compute average
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started