Hash table space for time principle

   Hash table will not be repeatedly described principle, the only record key principle.

   The length of the hash table is generally fixed length, before storing the data, we should know the size of our data storage is how much should be avoided as much as possible often make a hash table expansion. But if the design is too large, it will be a waste of space, because we do not see with so much space to store the size of our current data; if the design is too small, it will be very prone to hash collision, fail to reflect the efficiency of the hash table. So, we designed the size of the hash table, hash collision must be done to reduce as much as possible, and should as far as possible without wasting space, choose the right size of the hash table hash table is to enhance the performance of critical .

   In short, the key to the efficiency of the hash table is a hash algorithm and hash collision. The lower the hash collision, the higher the efficiency. In order to reduce hash conflicts, we need greater than the actual amount of data stored in a hash table, which is the principle of space for time.

  Using the hash table bucket node as a memory model in STL.
 

Published 14 original articles · won praise 11 · views 10000 +

Guess you like

Origin blog.csdn.net/u010810750/article/details/104119273