Binary search runs in O(log n) time.
Michael George Tuesday March 29, 2005
This is a proof that binary search runs in O(log n) time. Here is the code: binsearch (A, x, a, b) if b = a then return false b-a m 2 +a if A[m] > x then return binsearch (A,
Threads and Concurrency
Announcements
ACSU final general meeting of the year
Wed 4/25, 5pm, Upson Lounge (117) Speaker: Gun Sirer on P2P networks Free food!
Online course evaluations are available from now until next Monday noon please visit
Balanced Search Trees
Prelim tonight!
Lecture 22 CS211 Spring 2007
Some Search Structures
Sorted Arrays
Advantages
Search in O(log n) time (binary search)
Balanced Search Trees
Best of both!
Search, insert, delete in O(log n) time No need to
Prelim 2 Reminder
Prelim 2 Prelim 2 Review Session
Sunday 4/15,1:30-3:00pm Kimball B11 Individual appointments are available if you cannot attend the review session (email one TA to arrange appointment)
Graphs
Tuesday, April 17, 7:30-9pm Uris Audit
GUI Statics and GUI Dynamics GUI Dynamics
Statics: whats drawn on the screen
Components
buttons, labels, lists, sliders, menus, .
Dynamics: user interactions
Events
button-press, mouse-click, keypress, .
Containers: components that contain other co
Generic Types in Java 5 Generic Types and the Java Collections Framework
When using a collection (e.g.,
LinkedList, HashSet, HashMap), we generally have a
single type T of elements that we store in it (e.g., Integer,
String)
Generics in Java 1.5 pr
The Bag Interface
Priority Queues and Heaps
interface Bag<E> { void put(E obj); E get(); /extract some element boolean isEmpty(); }
Lecture 16 CS211 Spring 2007
Examples: Stack, Queue
Stacks and Queues as Lists
Stack (LIFO) implemented as list
p
Abstract Data Types (ADTs) Standard ADTs
A method for achieving abstraction for data structures and algorithms ADT = model + operations Describes what each operation does, but not how it does it Lecture 15 CS211 Spring 2007 An ADT is independent of
Compiling for Different Platforms
Program written in some high level language (C, Fortran, ML, .) Compiled to intermediate form
Under the Hood: The Java Virtual Machine
Lecture 24 CS211 Spring 2007
Optimized Code generated for various platfor