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.