This preview shows pages 1–3. Sign up to view the full content.
Graphs
Lecture 20
CS211 – Spring 2007
2
Prelim 2 Reminder
y
Prelim 2
±
Tuesday, April 17, 7:309pm
±
Uris Auditorium
±
One week from today!
±
Topics: all material up to (but
not including) this week's
lectures
±
Does
not
include graphs
y
Exam conflicts
±
Email Kelly Patwell (ASAP)
y
Prelim 2 Review Session
±
Sunday 4/15,1:303:00pm
±
Kimball B11
±
Individual appointments are
available if you cannot attend
the review session (email
one
TA to arrange appointment)
y
Old exams are available for
review on the course website
3
Prelim 2 Topics
y
Asymptotic complexity
y
Searching and sorting
y
Basic ADTs
±
stacks
±
queues
±
sets
±
dictionaries
±
priority queues
y
Basic data structures used to
implement these ADTs
±
arrays
±
linked listshash tables
±
BSTs
±
balanced BSTs
±
heaps
y
Know and understand the sorting
algorithms
±
From lecture
±
From text (not Shell Sort)
y
Know the algorithms associated
with the various data structures
±
Know BST algorithms, but don’t
need to memorize
balanced
BST
algorithms
y
Know the runtime tradeoffs
among data structures
y
Don’t worry about details of JCF
±
But should have basic
understanding of what’s available
4
Prelim 2 Topics
y
Language features
±
inheritance
±
inner classes
±
anonymous inner classes
±
types & subtypes
±
iteration & iterators
y
GUI statics
±
layout managers
±
components
±
containers
y
GUI dynamics
±
events
±
listeners
±
adapters
5
Data Structure Runtime Summary
y
Stack [ops = put & get]
±
O(1) worstcase time
²
Array (but can overflow)
²
Linked list
±
O(1) time/operation
²
Array with doubling
y
Queue [ops = put & get]
±
O(1) worstcase time
²
Array (but can overflow)
²
Linked list (need to keep track
of both head & last)
±
O(1) time/operation
²
Array with doubling
y
Priority Queue [ops = insert &
getMin]
±
O(1) worstcase time
²
Bounded height PQ (only works if
few priorities)
±
O(log n) worstcase time
²
Heap (but can overflow)
²
Balanced BST
±
O(log n) time/operation
²
Heap (with doubling)
±
O(n) worstcase time
²
Unsorted linked list
²
Sorted linked list (O(1) for getMin)
²
Unsorted array (but can overflow)
²
Sorted array (O(1) for getMin, but
can overflow)
6
Data Structure Runtime Summary (Cont’d)
y
Set [ops = insert & remove &
contains]
±
O(1) worstcase time
²
Bitvector (can also do union
and intersect in O(1) time)
±
O(1) expected time
²
Hash table (with doubling &
chaining)
±
O(log n) worstcase time
²
Balanced BST
±
O(n) worstcase time
²
Linked list
²
Unsorted array
²
Sorted array (O(log n) for
contains)
y
Dictionary [ops = insert(k,v) &
get(k) & remove(k)]
±
O(1) expected time
²
Hash table (with doubling &
chaining)
±
O(log n) worstcase time
²
Balanced BST
±
O(log n) expected time
²
Unbalanced BST (if data is
sufficiently random)
±
O(n) worstcase time
²
Linked list
²
Unsorted array
²
Sorted array (O(log n) for
contains)
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document7
These are not Graphs
0
20
40
60
80
100
1st
Qtr
2nd
Qtr
3rd
Qtr
4th
Qtr
East
West
North
...not the kind we mean, anyway
8
These are Graphs
K
5
K
3,3
=
9
Applications of Graphs
y
Communication networks
y
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '06
 KOZEN

Click to edit the document details