{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ALG4.2

# ALG4.2 - Algorithms Professor John Reif Hash Function f:A...

This preview shows pages 1–6. Sign up to view the full content.

1 Algorithms Professor John Reif ALG 4.2 Universal Hash Functions: Auxillary Reading Selections: AHU-Data Section 4.7 BB Section 8.4.4 Handout: Carter & Wegman, "Universal Classes of Hash Functions", JCSS, Vol. 18, pp. 143-154, 1979. CLR - Chapter 34 2 f : A B keys indices Hash Function f has conflict at x,y e A if x π y but f(x) = f(y) s f (x, y) = { 1 if x π y and f(x) = f(y) 0 else

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

View Full Document
3 If H is a set of hash functions, for set of keys S, s H (x, y) = Â f e H s f (x, y) s H (x, S) = Â f e H Â y e S s f (x, y) 4 a Keys a b Indices conflicts / index f H OE a b ( ) a b - 1 ( ) Total Conflicts keys / index a b b a b ( ) a b - 1 ( ) [ ]] ] ] a 2 b - a
5 H is a universal 2 set of hash functions if s H (x, y) £ |B| |H| for all x, y e A i.e. no pair of keys x,y are mapped of all functions in H into the same index by > |B| 1 x y f f Conflict f(x) = f(y) 6 Given any set H of hash fn, \$ x,y e A s.t. Proposition 1 s H (x, y) > |H| ( |B| 1 - |A| 1 ) proof let a = |A| , b = |B| By counting, we can show A B f s f a b a b A A b a , ( ) - ( ) - 1 2 2

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

View Full Document
7 Thus s H (A, A) a 2 |H| ( b 1 - a 1 ) By the pidgeon hole principle \$ x,y e A s.t s H (x, y) > |H| ( b 1 - a 1 ) note in most applications, |A| >> |B| , and then any universal 2 class has asymptotically a minimum number of conflicts 8 Proposition 2: Let x A, A ' S c For f chosen randomly from a universal 2 class H of hash functions, the expected number of colisions is s f (x, S) £ |B| |S| proof E( s f (x, S)) = |H| 1 Â f e H f (x, S) = |H| 1 Â y e S s H (x, y) by definition £ | H | 1 Â y e S |B| |H| by definition of universal 2 = |B| |S| s
9 application

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern