如何散列在字典&LT工作的过程; TKEY的,TValue>字典、过程、工作、LT

2023-09-03 03:38:22 作者:多情是病,不治要命

如何散列工作词典的过程?我读了使用字典提供更快抬起头来。但不知道如何?如何散列和映射到一个索引发生呢?找不到任何很好的参考。

How does the process of hashing work in Dictionary? I read that using dictionary provides faster look up. But did not understand how? How does the hashing and mapping to an index happen? Couldn't find any good reference.

编辑: 如何在对象存储的散列函数的结果?

How is the actual memory location where the object is stored obtained from the result of the hashing function?

推荐答案

在一个字典的散列过程使用真实refered为链接的技术。 通过链接,辅助数据结构,用来持有任何冲突。具体地说,在字典的每个时隙具有映射到铲斗元件的阵列。在发生碰撞的情况下,碰撞元件是ppended到铲斗的列表$ P $

The hashing process in an Dictionary uses a technique that's refered to as chaining. With chaining, a secondary data structure is utilized to hold any collisions. Specifically, each slot in the Dictionary has an array of elements that map to a bucket. In the event of a collision, the colliding element is prepended to the bucket's list.

请参阅 MSDN上这个文章更多的细节。

See this article on MSDN for more details.