{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

View Full Document Right Arrow Icon
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
Image of page 1

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

View Full Document Right Arrow Icon
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
Image of page 2
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
Image of page 3

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

View Full Document Right Arrow Icon
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
Image of page 4
9 application
Image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern