如何散列在字典&LT工作的过程; TKEY的,TValue> [英] How does the process of hashing work in Dictionary<TKey, TValue>

查看:107
本文介绍了如何散列在字典&LT工作的过程; TKEY的,TValue>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

这篇关于如何散列在字典&LT工作的过程; TKEY的,TValue>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆