Lecture 8 Hashing II

Weakness of hashing:

For any choice of hash function, exists bad set of keys that all hash to same slot.

Idea:Choose hash function at random, independently from keys.

 

Universal hashing:

Define: Let U be a universe of keys, and let H be a finite collection of hash functions mapping U to {0,1,...,m-1}.

 

 

 

 

 

Perfect hashing:

 

 

 

 

 If ni items that hash to level-1 slot i, then use mi=ni2 slots in level-2 table.

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章