Notes 9 - Week 9: Hashing Dictionaries Chapters 17 and 18...

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

View Full Document Right Arrow Icon
Week 9: Hashing Dictionaries Chapters 17 and 18 on dictionaries will not be covered, however a few definitions are needed before discussing hashing. A dictionary contains entries with a key and other data that is associated with the key. Also a map or table . A key can be a field or item of data, a portion of a field, or a group of fields. Keys can be either unique or non-unique depending whether they return one or multiple matches. For example student ID is a unique key for a list of students, but not in a list of enrollment data (as a student who enrolls in two classes would be in the list twice.) A zip code is an example of a non-unique key. An actual dictionary uses the word as the key, and the other data includes the pronunciation, definitions, and ancestry of the word. Dictionaries can be sorted by key or unsorted. Review the chapter summary on page 459. Hashing Hashing is a technique that determines the location (index) based on the search key. A hash function inputs: search key outputs: hash index (integer address) Like f(x) notation, if h is the hash function, then h(searchKey) returns the index or address For all values in the list this produces a hash table with two columns: key and address Ideal hashing Definition : A perfect hash function maps each key to one unique element in the hash table. algorithm to add a new value to the table:
Background image of page 1

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

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

This note was uploaded on 01/23/2012 for the course CS 111C taught by Professor Metzler during the Spring '11 term at City College of San Francisco.

Page1 / 4

Notes 9 - Week 9: Hashing Dictionaries Chapters 17 and 18...

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

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