arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1505.01523cs.DS
收藏

使用制表快速而强大的哈希

Fast and Powerful Hashing using Tabulation

Mikkel Thorup

摘要:

随机算法通常因其简单性而受到欢迎,但用于产生所需概率保证的散列函数通常过于复杂而不实用。在这里,我们调查最近的结果如何简单的哈希方案的基础上制表提供意想不到的强有力的保证。简单的列表散列可以追溯到Zobrist [1970]。键被视为由$c$字符组成,我们有预先计算的字符表$h_1,...,h_c$将字符映射到随机哈希值。密钥$x=(x_1,...,x_c)$被散列为$h_1[x_1] \oplus h_2[x_2].....\oplus h_c[x_c]$。这种方案在缓存中使用字符表时非常快。虽然简单的制表甚至不是4-独立的,但它确实提供了许多通常通过更高的独立性获得的保证,例如,线性探测和布谷鸟散列。接下来我们考虑扭曲制表,其中一个输入字符以简单的方式“扭曲”。由此产生的散列函数具有强大的分布特性:Hoff-Hoeffding类型的尾部边界和非常小的最小散列偏差。这也产生了一个非常快的伪随机数生成器,它被证明适用于许多经典的随机算法和数据结构。最后,我们考虑双重制表,其中我们组成两个简单的制表函数,将一个应用于另一个的输出,并表明这在Carter和Wegman [1977]的经典框架中产生非常高的独立性。事实上,惠普,对于与所消耗的空间的大小成比例的给定大小集,双重制表给出完全随机散列。我们还提到了一些更详细的制表计划,在给定的时间和空间获得接近最佳的独立性。虽然这些制表方案都很容易实现和使用,但它们的分析却不容易。

英文摘要:

Randomized algorithms are often enjoyed for their simplicity, but the hash functions employed to yield the desired probabilistic guarantees are often too complicated to be practical. Here we survey recent results on how simple hashing schemes based on tabulation provide unexpectedly strong guarantees. Simple tabulation hashing dates back to Zobrist [1970]. Keys are viewed as consisting of $c$ characters and we have precomputed character tables $h_1,...,h_c$ mapping characters to random hash values. A key $x=(x_1,...,x_c)$ is hashed to $h_1[x_1] \oplus h_2[x_2].....\oplus h_c[x_c]$. This schemes is very fast with character tables in cache. While simple tabulation is not even 4-independent, it does provide many of the guarantees that are normally obtained via higher independence, e.g., linear probing and Cuckoo hashing. Next we consider twisted tabulation where one input character is "twisted" in a simple way. The resulting hash function has powerful distributional properties: Chernoff-Hoeffding type tail bounds and a very small bias for min-wise hashing. This also yields an extremely fast pseudo-random number generator that is provably good for many classic randomized algorithms and data-structures. Finally, we consider double tabulation where we compose two simple tabulation functions, applying one to the output of the other, and show that this yields very high independence in the classic framework of Carter and Wegman [1977]. In fact, w.h.p., for a given set of size proportional to that of the space consumed, double tabulation gives fully-random hashing. We also mention some more elaborate tabulation schemes getting near-optimal independence for given time and space. While these tabulation schemes are all easy to implement and use, their analysis is not.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑