lecture05 - Lecture 5 Hashing I: Chaining, Hash Functions...

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

View Full Document Right Arrow Icon
Lecture 5 Hashing I: Chaining, Hash Functions 6.006 Fall 2009 Lecture 5: Hashing I: Chaining, Hash Functions Lecture Overview Dictionaries Motivation — fast DNA comparison Hash functions Collisions, Chaining Simple uniform hashing “Good” hash functions Readings CLRS Chapter 11. 1, 11. 2, 11. 3. Dictionary Problem Dictionary: Abstract Data Type (ADT) maintaining a set of items , each with a key . E.g. (phonebook) keys are names, and their corresponding items are phone numbers E.g.2 (real dictionary) keys are english words, and their corresponding items are dictionary-entries Operations to Support : insert(item): add item to set delete(item): remove item from set search(key): return item with key if it exists Assumption: items have distinct keys (or that inserting new one clobbers old) Balanced BSTs solve in O (log n ) time per operation (in addition to inexact searches like nextlargest). What is the O ( · ) notation hiding? Reality: O (log n ) · key length — important distinction if key is not a number or key-length is larger than machine word. Our goal: O (1) time per operation (again we mean O (1) · key length). Using an idea called ‘Rolling Hash’ in the next lecture, we will sometimes manage to avoid paying the key length multiplicative penalty (on average). 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Lecture 5 Hashing I: Chaining, Hash Functions 6.006 Fall 2009 Motivation Example Application: How close is chimp DNA to human DNA? Find the longest common substring of two strings, e.g. ALGORITHM
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

lecture05 - Lecture 5 Hashing I: Chaining, Hash Functions...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online