08-Hashing-II

08-Hashing-II - Algorithms LECTURE 8 Hashing II Universal...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Algorithms L7.1 Professor Ashok Subramanian L ECTURE 8 Hashing II Universal hashing Universality theorem Constructing a set of universal hash functions Perfect hashing Algorithms
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Algorithms L7.2 A weakness of hashing Problem: For any hash function h , a set of keys exists that can cause the average access time of a hash table to skyrocket. I DEA : Choose the hash function at random, independently of the keys. Even if an adversary can see your code, he or she cannot find a bad set of keys, since he or she doesn’t know exactly which hash function will be chosen. An adversary can pick all keys from { k U : h ( k ) = i } for some slot i .
Background image of page 2
Algorithms L7.3 Universal hashing Definition. Let U be a universe of keys, and let H be a finite collection of hash functions, each mapping U to {0, 1, …, m –1} . We say H is universal if for all x , y U , where x y , we have |{ h H : h ( x ) = h ( y )}| = | H | / m . That is, the chance of a collision between x and y is 1/ m if we choose h randomly from H . H { h : h ( x ) = h ( y )} | H | m
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
L7.4 Universality is good Theorem. Let h be a hash function chosen (uniformly) at random from a universal set H of hash functions. Suppose h is used to hash n arbitrary keys into the m slots of a table T . Then, for a given key
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 19

08-Hashing-II - Algorithms LECTURE 8 Hashing II Universal...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online