0

When the load of the hash table grows too large in proportion to the hash table size, you increase the size of the hash table to improve performance. When the load is too large is dependant on a predetermined value, the load factor.

How do you refer to the term that decides when to decrease the size of the hash table when the load is too small?

if (load > size * 0.75)
    increase_size();
if (load < size * 0.25)
    decrease_size();

Here 0.75 is the load factor of the hash table. What do you call 0.25?

2
  • 2
    I don't think I've ever seen a hash table that automatically shrinks its storage. Out of curiosity, could you link to an example? – amon Oct 1 '17 at 17:20
  • I agree with @amon. You typically don't shrink hash tables. If they've grown large through use, you'll presumably need the space that the instance provides, even if not immediately. – Neil Oct 2 '17 at 11:55
1

You have denoted current load factor with load. The 0.75 is just a threshold for max load factor. Similarly 0.25 is a threshold describing the min load factor we are willing to tolerate.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.