Lecture 16: Breadth-First Search (BFS)
CS 360 Lecture Notes Lecture 16
Now that we have reviewed the basic terminology associated with graphs, the first
algorithm we will investigate is breadth-first search. This algorithm is used to find the
shortest pat
Lecture 7: Heapsort
CS 360 Lecture Notes Lecture 7
The first sort we looked at was insertion sort which had (average) run time O(n2) but
required a constant (with respect to n) amount of additional storage. Mergesort on the
other hand, had O(n lg n) run t
Lecture 8: Quicksort
CS 360 Lecture Notes Lecture 8
One of the most commonly used sorting algorithms is quicksort. While the worst case run
time of quicksort is O(n2), the average run time is O(n lg n) but typically with a smaller
constant than merge or h
Lecture 6: Recurrence
CS 360 Lecture Notes Lecture 6
We derived the run time for merge sort in lecture 4 by constructing a recursion tree and
then adding up the run times for each level of the recursion. The recursive equation for
merge sort, however, fit
Lecture 5: Master Theorem
CS 360 Lecture Notes Lecture 5
Since divide and conquer algorithms occur quite frequently and produce recursive
equations for their run times, it is important to be able to solve recursive equations. Last
lecture we "solved" the
Lecture 4: Merge Sort
CS 360 Lecture Notes Lecture 4
An approach used to solve many computational problems is divide and conquer. The
premise is to repeatedly subdivide a problem up into smaller (i.e. simpler) versions of the
original problem until the su
Lecture 2: Insertion Sort
CS 360 Lecture Notes Lecture 2
Insertion Sort
All sorting algorithms have the property that given a set of keys:
Input : Sequence of numbers <a1,a2,.,an>
Out put : Permutation <a1',a2',.,an'> such that a1' a2' . an'
Algorit hm
In
Lecture 3: Asymptotic Notation
CS 360 Lecture Notes Lecture 3
Last class we performed a detailed analysis of insertion sort only to end up discarding
most of the work by only keeping the highest order term. We intuitively described the
asymptotic growth o
Lecture 9: Linear Sorting
CS 360 Lecture Notes Lecture 9
So far we have seen four sorting algorithms of which three had a run time of O(n lg n). The
question that we always ask is - "Is there a better (faster) way to do this?" It turns out in
the case of
Lecture 15: Graph Theory
CS 360 Lecture Notes Lecture 15
This lecture will be a brief review of terminology from graph theory that will be used for the
algorithms in subsequent lectures. We assume that a graph G(V,E) is represented as a
pair of finite set
Lecture 11: Hash Tables
CS 360 Lecture Notes Lecture 11
While arrays are a common data structure used in many programs when the keys are in a
relatively small integer range, often there is a need to efficiently index non-integer keys
using a data structur
Lecture 14: Greedy Algorithms Activity Selection
CS 360 Lecture Notes Lecture 14
While dynamic programming can be successfully applied to a variety of optimization
problems, many times the problem has an even more straightforward solution by using a
greed
Lecture 13: Dynamic Programming Longest Common Subsequence
CS 360 Lecture Notes Lecture 13
To futher illustrate using dynamic programming, another problem that can be solved with
dynamic programming is finding the longest common subsequence between two
se
Lecture 10: Probabilistic Analysis
CS 360 Lecture Notes Lecture 10
Up to this point we have been considering algorithms deterministically, i.e. best and worst
case behavior. We have occasionally looked at average case behavior, but assumed that
all inputs
Lecture 1: Welcome To Introduction to
Algorithms!
CS 360 Lecture Notes Lecture 1
CS/ACC/PE 360 - Analysis of Algorithms, "Beancounting for Techies"
Accounting - Down to the penny - with "misc"
Algorithms - Asymptotic bounds - O(n)
Algorit hm - "a well def