03/11/2009
1
THREADS AND
CONCURRENCY
Lecture 20 – CS2110 – Fall 2009
Prelim 2 Reminder
2
Prelim 2
Tuesday 17 Nov, 7:30-9pm
Uris G01 Auditorium
Ten days from today!
y
Prelim 2 Review Session
Currently looking into scheduling and
room
Considering using the Tuesday class
as a review session (the day of the
Topics: all material up to and
including this week's lectures
Includes graphs
Exam conflicts
Email Ken (ASAP)
exam itself).
Would people like this?
Will announce decision on newsgroup
and course web page soon
y
Old exams are available for
review on the course website
Prelim 2 Topics
3
Asymptotic complexity
Searching and sorting
Basic ADTs
stacks
queues
y
Know and understand the sorting
algorithms
From lecture
From text (not Shell Sort)
y
Know the algorithms associated
with the various data structures
sets
dictionaries
priority queues
Basic data structures used to
implement these ADTs
arrays
linked lists
hash tables
binary search trees
heaps
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 API
But should have basic understanding
of what’s available
Prelim 2 Topics
4
Language features
inheritance
inner classes
anonymous inner classes
types & subtypes
y
GUI dynamics
events
listeners
adapters
iteration & iterators
GUI statics
layout managers
components
containers
Data Structure Runtime Summary
5
Stack [ops = put & get]
O(1) worst-case time
Array (but can overflow)
Linked list
O(1) time/operation
y
Priority Queue [ops = insert &
getMin]
O(1) worst-case time if set of priorities
is bounded
One queue for each priority
O(log n) worst case time
Array with doubling
Queue [ops = put & get]
O(1) worst-case time
Array (but can overflow)
Linked list (need to keep track of
both head & last)
O(1) time/operation
Array with doubling
O(log n) worst-case time
Heap (but can overflow)
O(log n) time/operation
Heap (with doubling)
O(n) worst-case 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)
Data Structure Runtime Summary (Cont’d)
6
Set [ops = insert & remove &
contains]
O(1) worst-case time
Bit-vector (can also do union and
intersect in O(1) time)
O(1) expected time
y
Dictionary [ops = insert(k,v) &
get(k) & remove(k)]
O(1) expected time
Hash table (with doubling & chaining)
O(log n) worst-case time
Balanced BST
Hash table (with doubling & chaining)
O(log n) worst-case time
Balanced BST
O(n) worst-case time
Linked list
Unsorted array
Sorted array (O(log n) for contains)
O(log n) expected time
Unbalanced BST (if data is sufficiently
random)
O(n) worst-case time
Linked list
Unsorted array
Sorted array (O(log n) for contains)

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*