Hash code statistics
Assuming a perfectly-distributed hash function, there are
a few main statistical characteristics to be aware of:
- given a particular hash code length, the chance that two items with
different content will have the same hash code;
- given a particular table size, the chance of a collision;
- given a particular table size and number of items, the distribution
of number of items per slot in the table.
In reality, all of these statistics are related.
If you enjoy this Java programming article, please share with friends and colleagues. Follow the author on Twitter for the latest news and rants.
Editorial page content written by Neil Coffey. Copyright © Javamex UK 2021. All rights reserved.