Hashtable-老调重弹 [英] Hashtable- Rehashing

查看:192
本文介绍了Hashtable-老调重弹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已被告知,的Hashtable .NET 使用,以减少/避免碰撞的老调重弹。

I have been told that Hashtable in .NET uses rehashing in order to reduce/avoid collision.

IE浏览器。 Rehasing工作如下:假设我们有一组散列不同的功能,H1 ... Hn的,并插入或检索从哈希表中的项时,使用最初在H1散列函数。

Ie. "Rehasing works as follows: assume we have a set of hash different functions, H1 ... Hn, and when inserting or retrieving an item from the hash table, initially the H1 hash function is used. If this leads to a collision, H2 is tried instead and onwards up to Hn to avoid collision in Hashtable."

假设:我们有n(其中n℃的哈希表;无限远)元素,其中时间复杂度为O(1);我们(CLR)已经实现这一点的同时运用一些散列函数(HN-1散列函数,其中n> 1)

Assumption: We have a hashtable with n (where n < Infinity) element where asymptotic time complexity is o(1); we (CLR) have achieved this while applying some hashing function ( Hn-1 hash function where n>1).

问:
能有人给我解释一下怎么样CLR地图关键的哈希码时,我们寻求(检索)的任何元素(如果使用不同的散列函数)?如何CLR轨道(如果)任何活的对象(哈希表)?

Question: Can someone explain me how CLR map Key to the hash code when we seek (retrieve) any element (if different hashing functions are used)? How CLR track (if it) the hashing function of any live object (hash table)?

在此先感谢

推荐答案

散列函数的随机选择是知道的完美散列办法。据我所知每个一些初始化过程中选择一次哈希函数,所以这是不是一个真正的情况下,当在一个哈希表的范围是使用多个散列函数。

Random selection of a hash function is know as Universal Hashing approach. AFAIK the hash function selected once per some initialization process so this is not a real case when in scope of a single hash table were used multiple hash functions.

修改详细信息

刚回到家里,打开算法导论T. Cormen书,发现在部分下面的 11.3.3通用散列

Just back at home, opened "Introduction to algorithms" T. Cormen book and found following in the section 11.3.3 Universal Hashing:

背后完美散列的主要思想是随机从精心设计的选择哈希函数
类函数在执行

The main idea behind universal hashing is to select the hash function at random from a carefully designed class of functions at the beginning of execution

您可以通过在谷歌图书网站预览书阅读更多<一的
开头HREF =http://books.google.com.ua/books?id=NLngYyWFl_YC&pg=PA232&lpg=PA232&dq=cormen%20universal%20hashing%2011.3.3&source=bl&ots=BxOtCB2nCa&sig = AdPph7Gg6B1qXcvNsNBKkiGlwzI&安培; HL =英国和放大器; EI = l2SDTu_9ELHT4QTf5JFv&安培; SA = X&安培; OI = book_result&安培; CT =导致&安培; resnum = 1&安培; VED = 0CBsQ6AEwAA#v = onepage&放大器; q&安培; F =假相对=nofollow>此处

You can read more by previewing the book at the Google Books site here

这篇关于Hashtable-老调重弹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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