lecture15

lecture15 - 1 Wednesday,March2 nd Tables HashTables...

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

View Full Document Right Arrow Icon
1 Wednesday, March 2 nd     Tables Hash Tables Closed hash tables + Linear Probing Open hash tables Review Challenge
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 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  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
Background image of page 2
3 “Tables” Let’s 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: 
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 “Tables” Let’s 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
Background image of page 4
5 Implementing Tables How could you  create a record  in C++?
Background image of page 5

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

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

This note was uploaded on 05/11/2011 for the course CS 33 taught by Professor Rohr during the Spring '08 term at UCLA.

Page1 / 48

lecture15 - 1 Wednesday,March2 nd Tables HashTables...

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

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