2

If my intention is only to have a good hash function that spreads data evenly into all of the buckets, then I need not come up with a family of hash functions, I could just do with one good hash function, is that correct?

The purpose of having a family of hash functions is only to make it harder for the enemy to build a pathological data set as when we pick a hash function randomly, he/she has no information about which hash function is employed. Is my understanding right?

EDIT: Since someone is trying to close as unclear; This question is to know the real purpose of employing a Universal family of hash functions.

4

1 回答 1

-1

我可以只用一个好的散列函数,对吗?

正如您稍后在问题中指出的那样,一个知道您正在使用哪个哈希函数的“敌人”可以准备一个病态数据集。

此外,散列只是将数据存储到表存储桶中的第一阶段 - 如果您正在实施开放寻址/封闭散列,您还需要选择替代存储桶以在冲突后进行探测:线性和二次探测等简单方法通常提供足够的冲突避免,并且可能在数学上更简单,因此比重新散列更快,但它们不保持下一个探测在负载因子下找到未使用的桶的概率。使用另一个好的散列函数(包括此类函数系列中的另一个)进行重新散列,因此如果这对您很重要,您可能更喜欢使用散列函数系列。

还要注意,有时内存中的哈希表用于说明磁盘数据上的哪些偏移量/扇区存储,因此使用已经在内存中的数据进行额外的重新哈希计算可能比更高的概率(线性/二次探测)等待磁盘 I/O 只是为了发现另一个冲突。

于 2016-02-08T02:17:32.213 回答