Term Used in Examples Below | Common Term in Literature | Note |
---|---|---|
keysPerBucket | loadRatio | average number of keys per bucket |
keyCount | size | key count |
bucketCount | length | bucket count (hash table length) |
keysPerBucket = keyCount / bucketCount
bucketCount = keyCount / keysPerBucket
keyCount = bucketCount * keysPerBucket
Given: keyCount = 15 bucketCount = 5 Compute: keysPerBucket = 15/5 = 3 (keysPerBucket is an average)
Given: keyCount = 15 keysPerBucket = 3 Compute: bucketCount = 15 / 3 = 5
Given: bucketCount = 5 keysPerBucket = 3 Compute: keyCount = 5 * 3 = 15
initCapacity = 15 maxLoadRatio = 3
keyCount = initCapacity = 15 keysPerBucket = maxLoadRatio = 3