How is the c#/.net 3.5 dictionary implemented?

后端 未结 5 1274
無奈伤痛
無奈伤痛 2020-12-01 00:22

I\'m using an application which uses a number of large dictionaries ( up to 10^6 elements), the size of which is unknown in advance, (though I can guess in some cases). I\'m

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 00:34

    Hashtables normally have something called a load factor, that will increase the backing bucket store if this threshold is reached. IIRC the default is something like 0.72. If you had perfect hashing, this can be increased to 1.0.

    Also when the hashtable needs more buckets, the entire collection has to be rehashed.

提交回复
热议问题