MIT 6 006 - STUDY GUIDE (37 pages)

Previewing pages 1, 2, 17, 18, 19, 36, 37 of 37 page document View the full content.
View Full Document

STUDY GUIDE



Previewing pages 1, 2, 17, 18, 19, 36, 37 of actual document.

View the full content.
View Full Document
View Full Document

STUDY GUIDE

37 views


Pages:
37
School:
Massachusetts Institute of Technology
Course:
6 006 - Introduction to Algorithms
Introduction to Algorithms Documents

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 6 006 Recitation Build 2008 14 Coming up next Open addressing Karp Rabin coming back from the dead to hunt us Open Addressing Goal use nothing but the table Hoping for less code better caching Hashing we must handle collisions Solution try another location Easy Collision handling h x standard hash function if T h x is taken try T h x 1 then T h x 2 then T h x 3 just like parking a car h 29 h 29 1 h 29 2 h 29 3 0 1 2 3 4 5 6 7 8 9 taken taken taken taken taken here taken Collision Handling Abstracting it Up h k grows up to H k i where i is the attempt number rst try T H k 0 0 1 2 3 4 5 6 7 8 H 29 0 9 taken taken taken taken taken taken taken taken taken taken Collision Handling Abstracting it Up h k grows up to H k i where i is the attempt number rst try T H k 0 then T H k 1 0 H 29 1 1 2 3 4 5 6 7 8 H 29 0 9 taken taken taken taken taken taken taken taken taken taken Collision Handling Abstracting it Up h k grows up to H k i where i is the attempt number rst try T H k 0 then T H k 1 then T H k 2 0 H 29 1 1 2 3 H 29 2 4 5 6 7 8 H 29 0 9 taken taken taken taken taken taken taken taken taken taken Collision Handling Abstracting it Up h k grows up to H k i where i is the attempt number rst try T H k 0 then T H k 1 then T H k 2 stop after trying all H 29 3 H 29 1 H 29 4 H 29 9 H 29 2 H 29 5 H 29 6 H 29 7 H 29 8 H 29 0 0 1 2 3 4 5 6 7 8 9 taken taken taken taken taken taken taken taken taken taken Collision Handling Abstracting it Up H k H k 0 H k 1 H k 2 Linear probing h 29 4 Hlinear 29 4 5 6 7 8 9 0 1 2 3 General properties H 29 3 H 29 1 H 29 4 H 29 9 H 29 2 H 29 5 H 29 6 H 29 7 H 29 8 H 29 0 0 1 2 3 4 5 6 7 8 9 taken taken taken taken taken taken taken taken taken taken Collision Handling Abstracting it Up Any collision handling strategy comes to for key k probe H k 0 then H k 1



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view STUDY GUIDE and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view STUDY GUIDE and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?