Object Oriented Programming and Design in Java
Session 20 Instructor: Bert Huang
Object Oriented Programming and Design in Java Session 20 - - PowerPoint PPT Presentation
Object Oriented Programming and Design in Java Session 20 Instructor: Bert Huang Announcements Homework 4 due Monday, Apr. 19th ( next class) Review Homework tips Data Structures Lists, Stacks, Queues Sets, HashSet
Session 20 Instructor: Bert Huang
class)
sets
insert insert at remove remove at contains lists stacks/ queues set map
O(1) O(N) O(1) O(N) O(N) O(1) X O(1) X X O(1) X O(1) X O(1) O(1) ~O(1) O(1) ~O(1) O(1)
environments provide efficient implementations of standard ADTs
apply in different situations
browsers, puts request in queue
serve web pages to browsers
and first-come-first-serve scheduling
requests service
Deque<E>
scope are pushed
System.out.println(scanner.next())
memory
public void runForever() { runForever(); }
next() println() runForever() runForever() runForever() runForever() runForever()
as sets of keywords
contains() on each document
document must be fast
cat fish pet fish rice chopsticks chopsticks deadlock threads
word sets: word counts
HashMap<String, Integer>
each word
to be
not 1 1 1 1 +1 +1
called Red-Black Tree
12
determines which child to move to
each operation
7 5 10 2 6 15
store due dates in a BST
the key)
applications
keys of children greater than parentʼs
2 5 10 7 6 11 40
insert findMin get
get range
lists hashmap BST heap
O(1) O(N) O(N) X O(1) O(N) O(1) X O(log N) O(log N) O(log N) O(N) O(log N) O(1) O(N) X
assign priority to all requests
element
application
prioritization and just do it fast
requests service
extremely fast, thread safety is omitted to avoid overhead
implemented by ConcurrentHashMap
implemented by ArrayBlockingQueue, LinkedBlockingQueue
Collection synchronizedCollection(Collection c)
collections/implementations/index.html