CS38, Spring 2012
Introduction to Algorithms
Prof. Alexei Kitaev
Solutions to problem set #3
Problem 1. Without loss of generality we may assume that h1 h2 . If h1 h2 2, we
can use the standard balanc
CS38
Midterm Exam
May 4, 2012
1. Due no later than Friday May 11, 2012 at 5:00pm in the computer lab.
2. This exam is not timed, plan your work as is convenient to you.
3. You may use the following re
Outline
Divide and Conquer design paradigm
closest pair (finishing up)
the DFT and the FFT
polynomial multiplication
polynomial division with remainder
CS38
Introduction to Algorithms
Lecture 8
A
5/27/2014
Outline
coping with intractibility
NP-completeness
special cases
fixed parameter complexity
approximation algorithms
CS38
Introduction to Algorithms
Lecture 17
May 27, 2014
May 27, 2014
#include <iostream>
#include <fstream>
using namespace std;
float GetInches(ifstream& rainFle, int numberOfDays);
/ Function returns the total inches of rain
/ Pre: File rainFile has been opened; numb
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
cfw_
string str,st; / this string is to save the string
string origin[10]; / this string array is to save the s
Administrative
Lecture 7 Greedy Methods and Priority Queues
(Huffman Codes, Heapsort, Prims MST Alg)
These lecture notes for Introduction to Algorithms, CS38, are in draft
form. They may not be republ
Lecture 3 cont. Dynamic Programming
These lecture notes for Introduction to Algorithms, CS38, are in draft
form. They may not be republished or posted without permission.
Note on ps1 problem 2, it is
Administrative
Lecture 6 Greedy Methods and Duality
These lecture notes for Introduction to Algorithms, CS38, are in draft
form. They may not be republished or posted without permission.
In problem 2-
Administrative
Read the syllabus carefully.
Lecture 1 Course Overview. Recursion & Duality
These lecture notes for Introduction to Algorithms, CS38, are in draft
form. They may not be republished or p
Administrative
Lecture 14 Divide and Conquer: Matrix Multiplication
and Inversion. Streaming Algorithms.
These lecture notes for Introduction to Algorithms, CS38, are in draft
form. They may not be re
Administrative
Lecture 4 cont. Dynamic Programming
Reading CLRS Chs. 16, 21.1-3 (not covering path compression), 23
These lecture notes for Introduction to Algorithms, CS38, are in draft
form. They ma
Divide & Conquer: Arithmetic
Arithmetic in decimal (or binary) notation. Addition is simple:
grade-school algorithm. Add two n-bit numbers in time O(n). Subtraction
equally easy.
Lecture 13 Divide and
Administrative
Lecture 10 All-Pairs Shortest Paths (Floyd-Warshall,
Johnson); Space-Efficient s-t Connectivity (Savitch)
These lecture notes for Introduction to Algorithms, CS38, are in draft
form. Th
Outline
review of Dijkstras algorithm
CS38
Introduction to Algorithms
greedy algorithms: Huffman codes
data structures for MST and Dijkstras
union-find with log* analysis
Lecture 5
April 15, 2014
5/23/2014
Outline
Linear programming
LP duality
ellipsoid algorithm
CS38
Introduction to Algorithms
* slides from Kevin Wayne
Lecture 16
May 22, 2014
coping with intractibility
NP-completeness
Ma
Outline
CS38
Introduction to Algorithms
Lecture 1
April 1, 2014
administrative stuff
motivation and overview of the course
stable matchings example
graphs, representing graphs
graph traversals (BFS, D
5/17/14
Outline
Network flow
CS38
Introduction to Algorithms
finishing edge-disjoint paths
assignment problem
Linear programming
Lecture 13
May 13, 2014
* slides from Kevin Wayne
May 12, 2014
CS38
Outline
data structures for MST and Dijkstras
union-find with log*n analysis (finishing up)
CS38
Introduction to Algorithms
amortized analysis: potential function method
Fibonacci heaps
Lecture 6
Outline
CS38
Introduction to Algorithms
three glimpses beyond material in this
course
Lecture 20
June 5, 2014
property testing
streaming algorithms
approximation via semidefinite programming
June 5, 2
5/21/2014
Outline
Linear programming
simplex algorithm
LP duality
ellipsoid algorithm
CS38
Introduction to Algorithms
Lecture 15
May 20, 2014
* slides from Kevin Wayne
May 20, 2014
CS38 Lecture 15
5/29/2014
Outline
coping with intractibility
approximation algorithms
CS38
Introduction to Algorithms
set cover
TSP
center selection
Lecture 18
May 29, 2014
May 29, 2014
CS38 Lecture 18
randomne