help please cse problem Problem 4. [15 pts] Given: the hash function: h(x) = | 2
ID: 3767929 • Letter: H
Question
help please
cse problem
Explanation / Answer
You have a function which given a number (x) determines where that should go in a table. The table has a given size, N. In the case of parts a and b of this question N is 11. M is 11 for questions a, b and c. M is just a value which is plugged into the given formula h(x) = (2x + 5) mod M So given the number 12, h(12) = (2 * 12 + 5) mod 11 => 7. So the first result goes into bucket 7. You then work your way through the rest of the numbers in turn, working out what h(x) is for each. However, when you come to a collision (i.e. a scenario where the bucket which the number should go in has already been filled by a previous number) you need to select a different bucket for it. Which bucked you select will depend on your overflow strategy. If C is taken as read I assume it means that take the numbers from the start of the list until you hit the first collision; however many numbers you already have in your bucket is the value for N. However, I believe question C I believe is a misprint. I think it wants you to find a value for M which would allow the given list of numbers to all be assigned to a unique bucket (i.e. no collisions / no overflow strategy).
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.