lec6 - MIT OpenCourseWare http/ocw.mit.edu 6.006...

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

View Full Document Right Arrow Icon
MIT OpenCourseWare http://ocw.mit.edu 6.006 Introduction to Algorithms Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .
Image of page 1

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

View Full Document Right Arrow Icon
Lecture 6 Hashing II: Table Doubling, Karp-Rabin 6.006 Spring 2008 Lecture 6: Hashing II: Table Doubling, Karp-Rabin Lecture Overview Table Resizing Amortization String Matching and Karp-Rabin Rolling Hash Readings CLRS Chapter 17 and 32.2. Recall: Hashing with Chaining: 1 . . . . U k k k k k 1 2 3 4 k . . . 4 k . k 2 k 3 all possible keys n keys in set DS Cost : Θ (1+α) h table m slots collisions expected size α = n/m } Figure 1: Chaining in a Hash Table Multiplication Method: h ( k ) = [( a k ) mod 2 w ] ( w r ) · where m = table size = 2 r w = number of bits in machine words a = odd integer between 2 w 1 and 2 w 1
Image of page 2
Lecture 6 Hashing II: Table Doubling, Karp-Rabin 6.006 Spring 2008 w k a x } r } w-r keep ignore ignore + product as sum lots of mixing Figure 2: Multiplication Method How Large should Table be?
Image of page 3

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

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