Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5: Hash tables If we place n distinct elements into a hash table of size m using a good hash function, how many elements do

image text in transcribed

5: Hash tables If we place n distinct elements into a hash table of size m using a good hash function, how many elements do we expected to find in each table position? 1. 2. Recall the multiplicative hash function hash(x) (x.hashCode() * z) >>>w-d. In 32-bit Java, what is the value of w? How large is the table that is used with this hash function? (In other words, what is the range of this hash function?) Write this function in more standard mathematical notation using the mod and div (integer division) operators. a. b. c. 3. 4. Explain the relationship between a class's hashCode() method and its equals(o) method. Explain, in words, what is wrong with the following hashCode() method: public class Point2D Double x,y; public int hashCode return x.hashCode ) ^ y.hashCode O; Give an example of many points that all have the same hashCode) 5 Explain, in words, what is wrong with the following hashCode() method: public class Point2D Double x,y; public int hashCode ) return x.hashCode ) + y.hashCode Give an example of 2 different points that have the same hashCode)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions