Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q 3 Hash Functions Galore 2 Points Question 3 . 1 Q 3 . 1 1 Point Grading comment: Suppose we have a Dog class

Q3 Hash Functions Galore
2 Points
Question 3.1
Q3.11 Point
Grading comment:
Suppose we have a Dog class where each Dog has a name and a weight. Suppose we are trying to create the hashCode for our Dog class. Which of the two hashCodes below would guarantee to result in the two equivalent Dog objects, d1 and d2, being hashed to the same bucket in our hash table?
Dog d1= new Dog("Zeus",5);
Dog d2= new Dog("Zeus",5);
public int hashCode1(){
return (int)(Math.random()*20)+1;
}
public int hashCode2(){
return (int)this.name.length();
}
Choice 1 of 2:hashCode1()
Choice 2 of 2:hashCode2()

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

Recommended Textbook for

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions

Question

What should Gail do now?

Answered: 1 week ago