2

PROGRAM of how hashtable collision can occur?

I have read that a hash collision only means that the hashCode is not unique, which puts you into calling equals(), and the more duplicates there are the worse the performance.

kavya
  • 182
  • 3
  • 15
  • @ Stephen C I am not able to find the program in the given link "How do HashTables deal with collisions?" – kavya Oct 17 '18 at 11:30

1 Answers1

2

This is at least partly answered here: How do HashTables deal with collisions?

Collisions occur when two different values are hashed into the same slot. For example, if 2,450 keys are hashed into a million buckets, even with a perfectly uniform random distribution, according to the birthday problem there is approximately a 95% chance of at least two of the keys being hashed to the same slot (Source: Wikipedia; https://en.wikipedia.org/wiki/Hash_table).

K. K.
  • 136
  • 7