Does it make sense to resize the hash table? And when?

The implementation of My Hash Table has the function of resizing the table when loading about 70%. My Hash table is implemented with a separate collision chain.

Does it make sense that I should resize the hash table at any time or just leave it as it is? Otherwise, if I increase the size (almost twice, in fact I follow this: http://planetmath.org/encyclopedia/GoodHashTablePrimes.html ) when the load is 70%, should I resize it when the load reaches 30% or lower?

+3
source share
3 answers

- ? . , . , - , .

+1

, - (. ). , .

? , - -, , , i ( ) i - n/2.

+3

If the memory is cheap, leave it alone. If the memory is expensive, change it using hysteresis, as you suggested. When done, comment on the result to make sure that it works well and hasn’t done something stupid.

+2
source

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


All Articles