Threads and Concurrency
Lecture 20 – CS2110 – Fall 2008
2
Prelim 2 Reminder
!
Prelim 2
"
Tuesday 18 Nov, 7:309pm
"
Uris Auditorium
"
One week from today!
"
Topics: all material up to and
including this week's lectures
"
Includes graphs
!
Exam conflicts
"
Email Kelly Patwell (ASAP)
!
Prelim 2 Review Session
"
Sunday 4/15,1:303pm
"
Upson B17
"
Individual appointments are
available if you cannot attend
the review session (email
one
TA to arrange appointment)
!
Old exams are available for
review on the course website
3
Prelim 2 Topics
!
Asymptotic complexity
!
Searching and sorting
!
Basic ADTs
"
stacks
"
queues
"
sets
"
dictionaries
"
priority queues
!
Basic data structures used to
implement these ADTs
"
arrays
"
linked lists
"
hash tables
"
binary search trees
"
heaps
!
Know and understand the sorting
algorithms
"
From lecture
"
From text (not Shell Sort)
!
Know the algorithms associated
with the various data structures
"
Know BST algorithms, but don’t
need to memorize
balanced
BST
algorithms
!
Know the runtime tradeoffs
among data structures
!
Don’t worry about details of API
"
But should have basic
understanding of what’s available
4
Prelim 2 Topics
!
Language features
"
inheritance
"
inner classes
"
anonymous inner classes
"
"
!
GUI statics
"
layout managers
"
components
"
containers
!
GUI dynamics
"
events
"
listeners
"
adapters
5
Data Structure Runtime Summary
!
"
O(1) worstcase time
#
Array (but can overflow)
#
Linked list
"
O(1) time/operation
#
Array with doubling
!
"
O(1) worstcase time
#
Array (but can overflow)
#
Linked list (need to keep track
"
O(1) time/operation
#
Array with doubling
!
Priority Queue [ops = insert &
getMin]
"
O(1) worstcase time if set of
priorities is bounded
#
One queue for each priority
"
O(log n) worstcase time
#
Heap (but can overflow)
"
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)
!
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)
!
Dictionary [ops = insert(k,v) &
"
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
What is a Thread?
• A separate process that can perform a
This is the end of the preview.
Sign up
to
access the rest of the document.
 '07
 FRANCIS
 Array data structure

Click to edit the document details