Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(III) (8 points) There are various collision resolution strategies for hash tables. Please answer the following questions under the assumption of simple uniform hashing and
(III) (8 points) There are various collision resolution strategies for hash tables. Please answer the following questions under the assumption of simple uniform hashing and all keys are unique, given a hash table H with m slots to store n elements. 11. (3 points) Suppose we use chaining with the hash function h(k) k mod 5, and insert the following 13 keys into H with 5 slots in the exact sequence: 32,39,21,3,6,40, 34,24,15, 25, 7, 13,50. What is the expected number of key comparisons when searching for an element with the key k? (A) 10 (B) 2.6 (C) 3.0 (D) 3.6. 12. (5 points) Suppose we use double hashing of the form h(k,i) -(hi(k) ih2(k))mod m, where the primary hash function is defined as h(k)k mod 7 and the secondary hash function is defined as h2(k)5 - (k mod 5). Given H with 7 slots to insert the following 4 keys in the exact sequence: 35,42,3, 21. What is the index of the slot storing the clement with the key 21? (A) 0 (B) 3 (C) 4 (D) 5. (III) (8 points) There are various collision resolution strategies for hash tables. Please answer the following questions under the assumption of simple uniform hashing and all keys are unique, given a hash table H with m slots to store n elements. 11. (3 points) Suppose we use chaining with the hash function h(k) k mod 5, and insert the following 13 keys into H with 5 slots in the exact sequence: 32,39,21,3,6,40, 34,24,15, 25, 7, 13,50. What is the expected number of key comparisons when searching for an element with the key k? (A) 10 (B) 2.6 (C) 3.0 (D) 3.6. 12. (5 points) Suppose we use double hashing of the form h(k,i) -(hi(k) ih2(k))mod m, where the primary hash function is defined as h(k)k mod 7 and the secondary hash function is defined as h2(k)5 - (k mod 5). Given H with 7 slots to insert the following 4 keys in the exact sequence: 35,42,3, 21. What is the index of the slot storing the clement with the key 21? (A) 0 (B) 3 (C) 4 (D) 5
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