The "quality" of a hash is defined as the total number of comparisons needed to access every element once, relative to the expected number needed for a random hash. The value can go over 100%.
The total number of comparisons is equal to the sum of the squares of the number of entries in each bucket. For a random hash of "<n"> keys into "<k"> buckets, the expected value is: n + n(n-1)/2kMy doubt is :
why “The total number of comparisons is equal to the sum of the squares of the number of entries in each bucket”holds in the first place?
Intuitively , I think "the total number of comparisons for a random hash of n keys into k buckets " should be n(n+k)/2k
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |