Lecture 14 - Tables and Hash Tables

Lecture 14 - Tables and Hash Tables - Wednesday, March 7th...

Info iconThis preview shows pages 1–5. 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: Wednesday, March 7th Tables Hash Tables Closed hash tables Open hash tables Review Challenge Big-OH Craziness Consider a binary search tree that holds N student records, all indexed by their name . Each student record contains a linked-list of the L classes that they have taken while at UCLA. What is the big-oh to determine if a student has taken a class? bool HasTakenClass( BTree & b , string & name , string & class ) Name: Rick Classes: Left Right Class: CS31 Next: Name: Linda Classes: Left Right Class: CS31 Next: Class: EE10 Next: Name: Sal Classes: Left Right Class: Math31 Next: Class: Math31 Next: NULL Class: EE100 Next: NULL NULL NULL NULL NULL NULL Tables Lets say you want to want to write a program to keep track of all your BFFs Of course, you want to remember all the important dirt about each BFF: And you want to quickly be able to search for a BFF in one or more ways Find all the dirt on my BFF David Small Find all the dirt on the BFF whose number is 867-5309 Name: Carey Nash Phone number: 867-5309 Birthday: July 28 iPhone or droid: iPhone Fave food: Greek Fave Jersey Shore Actor: Tables Lets say you want to want to write a program to keep track of all your BFFs Of course, you want to remember all the important dirt about each BFF: Name: Carey Nash Phone number: 867-5309 Birthday: July 28 iPhone or droid: iPhone Fave food: Greek Fave Jersey Shore Actor: And you want to quickly be able to search for a BFF in one or more ways Find all the dirt on my BFF David Small Find all the dirt on the BFF whose number is 867-5309 In CS lingo, a group of related data (e.g., all about the same person) is called a Record. A BFF Record A Table is basically a collection of zero or more Records Simple! How can a user find a record? We pick one/two important fields and design a data structure that makes it fast to search the table for matching values in these fields. And each piece of data in the record is called a Field. Name Field Food Field Name: Carey Nash Phone number: 867-5309 Birthday: July 28 iPhone or droid: iPhone Fave food: Greek Fave Jersey Shore Actor: Name: David Small Phone number: 555-1212 Birthday: Aug 4 iPhone or droid: Neither Fave food: Pizza Fave Jersey Shore Actor: Name: John Rohr Phone number: 999-9191 Birthday: Jan 1 iPhone or droid: Droid Fave food: Cheerios Fave Jersey Shore Actor: Table of BFF Records We call these key fields . Key Field Key Field Implementing Tables...
View Full Document

This note was uploaded on 04/02/2012 for the course COMPUTER S 32 taught by Professor Smallberg during the Winter '12 term at UCLA.

Page1 / 54

Lecture 14 - Tables and Hash Tables - Wednesday, March 7th...

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

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