Thursday, October 28, 2010

When should you resize your hash table to a smaller one?

I'm using a Hashtable with seperate chaining.



After deteting enough elements in a hash table, it starts to look empty and wastes space. To be as effcient as possible i want to resize it to be smaller. If i'm currently re-hashing to a larger table when there are twice as many elements as table size, how empty should the table be before i should re-hash to a smaller table size?When should you resize your hash table to a smaller one?
In a hash table a common measure is the number of filled slots divided by the number of slots. This is commonly called the ';load factor.'; Maybe when the load factor drops to 0.5 (half empty)? It is your call.

No comments:

Post a Comment