What does a load factor of 0.75 mean?

I saw that the hash is implemented with a load factor of 0.75. What does it mean?

+4
source share
4 answers

this means that the capacity will be doubled as soon as the collection has enough elements to fit 3/4 of the capacity. Example: you have a hashmap with size 32. When you insert 24 elements into this hash map, it will automatically create a new hash file of size 64, intercept 24 elements and put them into the collection.

Details may depend on implementation and language, but I think the idea should be clear enough ...

+3
source

This means that the hash space (hash range) contains 33% more elements than the hash table should contain. Thus, the table should be no more than 75% filled.

0
source

The load factor refers to how many hash codes are filled. 75 means 75% or 3 in 4. It is unclear whether this means that the hash was actually 75% full or if the hash has changed 75%. You need to provide a little more context.

0
source

Source: https://habr.com/ru/post/1341614/


All Articles