Algorithms and Data Structures · Senior · Question 70 of 75

Why does a good hash function for strings process every character?

Explanation

Early Java versions hashed only some characters of long strings, and URLs with the same start collided heavily. The cost of reading the whole key is the price of an even spread.

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 70

Test yourself

Take the Algorithms and Data Structures · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz