Introduction to the Design and Analysis of Algorithms
CS 231

Fall 2004
Basic Graph Algorithms
(CLRS B.4B.5, 22.122.4)
1
Basic Graph Definitions
A graph G = (V, E) consists of a finite set of vertices V and a finite set of edges E. Directed graphs: E is a set of ordered pairs of vertices (u, v) where u, v V
1 2 3
V = cfw_1
Introduction to the Design and Analysis of Algorithms
CS 231

Fall 2004
Lecture 2: DivideandConquer and Growth of Functions
(CLRS 2.3,3)
1
Review
Last time we discussed running time of algorithms and introduced RAM model of computation. Bestcase running time: the shortest running time for any input of size n Worstcase ru
Introduction to the Design and Analysis of Algorithms
CS 231

Fall 2004
Heaps. Heapsort.
(CLRS 6)
1
Introduction
We have discussed several fundamental algorithms (e.g. sorting) We will now turn to data structures; Play an important role in algorithms design. Today we discuss priority queues and next time structures for maint
Introduction to the Design and Analysis of Algorithms
CS 231

Fall 2004
Linear Time Selection
(CLRS 9)
1
QuickSort Review
The last two lectures we have considered QuickSort: Divide A[1.n] (using Partition) into subarrays A = A[1.q  1] and A" = A[q + 1.n] such that all elements in A" are larger than A[q] and all elements i
Introduction to the Design and Analysis of Algorithms
CS 231

Fall 2004
Growth of Functions, Continued
CLRS 3 Last time we looked at the problem of comparing functions (running times). 3n2 lg n + 2n + 1 vs. 1000n lg 10 n + n lg n + 5 Basically, we want to quantify how fast a function grows when n . asymptotic analysis of algo