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

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

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 .

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

View Full Document
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
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? want

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.

## This note was uploaded on 09/24/2010 for the course CS 6.006 taught by Professor Erikdemaine during the Spring '08 term at MIT.

### Page1 / 6

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

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

View Full Document
Ask a homework question - tutors are online