lec7 - MIT OpenCourseWare http://ocw.mit.edu 6.006...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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 . Lecture 7 Hashing III: Open Addressing 6.006 Spring 2008 Lecture 7: Hashing III: Open Addressing Lecture Overview • Open Addressing, Probing Strategies • Uniform Hashing, Analysis • Advanced Hashing Readings CLRS Chapter 11.4 (and 11.3.3 and 11.5 if interested) Open Addressing Another approach to collisions no linked lists • • all items stored in table (see Fig. 1) item 2 item 1 item 3 Figure 1: Open Addressing Table • one item per slot = ⇒ m ≥ n • hash function specifies order of slots to probe (try) for a key, not just one slot: (see Fig. 2) Insert(k,v) for i in xrange(m): if T [ h ( k, i )] is None: empty slot T [ h ( k, i )] = ( k, v ) store item return raise ‘full’ 1 Lecture 7 Hashing III: Open Addressing 6.006 Spring 2008 h(k,3) h(k,1) h(k,4) h(k,2) k <h(k,φ), h(k,1), . . . , h(k, m-1)> <h(k,φ), h(k,1), ....
View Full 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

lec7 - 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 Right Arrow Icon
Ask a homework question - tutors are online