Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Text p 484 Execise 3.4.33 A bad string hash function. Consider the following hashCode() implementation for String, which was used in early versions of Java:

Text p 484 Execise 3.4.33 A bad string hash function. Consider the following hashCode() implementation

for String, which was used in early versions of Java:

public int hashCode() { int hash = 0; int skip = Math.max(1, length() / 8); for (int i = 0; i < length(); i += skip) hash = (hash * 37) + charAt(i); return hash; } 

Explain why you think the designers chose this implementation

and then

explain why you think it was abandoned in favor

of the one in the previous exercise (p.484 Ex 3.4.32)

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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

Identify several examples of ethical investing and SRI.

Answered: 1 week ago