© Thomas Mailund 2019
Thomas MailundThe Joys of Hashinghttps://doi.org/10.1007/978-1-4842-4066-3_4

4. Resizing

Thomas Mailund1 
(1)
Aarhus N, Denmark
 

If you know how performance degrades as the load factor of a hash table increases, you can use this to pick a table size where the expected performance matches your needs, presuming that you know how many keys the table will need to store. If you do not know the number of elements you need to store, n, then you cannot choose a table size, m, that ensures that α = n/m is below a desired upper bound. In most applications, you do not know n before you run your program. Therefore, you must adjust m as n increases by resizing the table.

You can download the code from this chapter from https://github.com/mailund/JoyChapter4 ...

Get The Joys of Hashing: Hash Table Programming with C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.