CSOR W4231.002 Spring, 2016
Homework 1
Out: Monday, January 25, 2016
Due: 8pm, Monday, February 8, 2016
Please keep your answers clear and concise. Collaboration is limited to discussion of ideas
only. You should write up the solutions entirely on your ow
CSOR W4231.002 Spring, 2016
Homework 1
Out: Monday, January 25, 2015
Due: 8pm, Monday, February 8, 2015
Please keep your answers clear and concise. Collaboration is limited to discussion of ideas
only. You should write up the solutions entirely on your ow
CSOR W4231.002 Spring, 2016
Homework 2
Out: Monday, February 8, 2016
Due: 8pm, Monday, February 22, 2016
Please keep your answers clear and concise. For all algorithms you suggest, you must prove correctness and give the best upper bound that you can for
Homework Assignment 1, Spring 2016
These problems are due at the beginning of class on Thursday, Feb. 4. They must be turned
in electronically on courseworks. Late submissions will be penalized at a rate of 10 pts per day.
You may discuss the problems wit
Analysis of Algorithms, I
CSOR W4231.002
Eleni Drinea
Computer Science Department
Columbia University
Tuesday, February 16, 2016
Outline
1 Recap: matrix chain multiplication
Organizing DP computations
2 Segmented least squares
An exponential recursive alg
Analysis of Algorithms, I
CSOR W4231.002
Eleni Drinea
Computer Science Department
Columbia University
Tuesday, February 9, 2016
Outline
1 Recap
2 Cache maintenance (the oine problem)
3 A greedy optimal algorithm for the oine problem:
FarthestintoFuture
Analysis of Algorithms, I
CSOR W4231.002
Eleni Drinea
Computer Science Department
Columbia University
Thursday, February 11, 2016
Outline
1 Recap
2 Matrix chain multiplication
3 A rst attempt: bruteforce
4 A second attempt: divide and conquer
5 A Dynamic
1/21/2016
Analysis of Algorithms I,
CSOR W4231
Spring 2016, Lecture 2
Allison Bishop
TexPoint fonts used in EMF.
Read the TexPoint manual before you delete this box.: AAAAA
More Examples of Asymptotic Notations:
Which grows faster as n ! 1?
p
n + log(n)
o
1/26/2016
Analysis of Algorithms I,
CSOR W4231
Spring 2016, Lecture 3
Allison Bishop
Solving Recurrences
A Master Theorem:
 Applies to many recurrences of the form:
T(n) = a T(n/b) + f(n)
(Here, a and b are constants, and f is an arbitrary function.)

1/19/2016
Analysis of Algorithms I,
CSOR W4231
Spring 2016, Lecture 1
Allison Bishop
TexPoint fonts used in EMF.
Read the TexPoint manual before you delete this box.: AAA
Course Logistics
Instructor office hours:
Tuesday, 10 am to noon, in Mudd 410 (DSI)
CSOR W4231: Analysis of Algorithms I
Class time: Tuesdays and Thursdays 7:10  8:25 PM
Class location: 309 Havemeyer Hall
Instructor: Allison Bishop
Oce hours for Instructor: Tuesday 10:00 AM  12:00 PM in 410 Mudd (DSI)
Instructor email: allison@cs.colum
Analysis of Algorithms, I
CSOR W4246
Eleni Drinea
Computer Science Department
Columbia University
Thursday, January 21, 2016
Outline
1 Asymptotic notation
2 The divide & conquer principle; application: mergesort
3 Solving recurrences and running time of M
CSOR W4231.002
Notes on the Master Theorem
29/1/2015
Often when analyzing a divide & conquer algorithm, we obtain a recurrence for its running time of
the following form
n
T (n) = aT ( ) + cnk
b
(1)
Essentially this recurrence says: on input of size n, we
Analysis of Algorithms, I
CSOR W4231.002
Eleni Drinea
Computer Science Department
Columbia University
Tuesday, January 20, 2015
Outline
1 Overview
2 A rst algorithm: Insertion Sort
3 Analysis of algorithms
4 Ecient algorithms
Algorithms
An algorithm is a
COMS 4231: Analysis of Algorithms I, Fall 2015
Problem Set 3, due Thursday October 22, 11:40am at on Courseworks.
Please follow the homework submission guidelines posted on courseworks.
Note: We plan to post solutions on Friday October 23, in preparation
Analysis of Algorithms, I
CSOR W4231.002
Eleni Drinea
Computer Science Department
Columbia University
Thursday, February 18, 2016
Outline
1 Recap
2 Data segmentation
A Dynamic Programming solution
3 Sequence alignment
4 Graphs
Today
1 Recap
2 Data segment
Analysis of Algorithms, I
CSOR W4231.002
Eleni Drinea
Computer Science Department
Columbia University
Thursday, February 25, 2016
Outline
1 Recap
2 Applications of BFS
Testing bipartiteness
3 Depthrst search (DFS)
4 Applications of DFS
Cycle detection
To
CSOR 4231
Homework #3 Solution
March 8, 2016
1
Problem 1
Let OP T (i) be the minimum total penalty to get to hotel i. Then
OP T (i) = min OP Tj + (200 (ai aj )2
0ji1
We want OP T (n). We can compute this by filling in a DP array with n + 1 entries in a
CSOR 4231 Assignment 2 Solution
March 5, 2016
1
Problem 1
Number of inversions corrected by Bubble sort equals to number of adjacent inversions in
the input permutation.
n
1
n(n 1)
Expected number of adjacent inversions =
=
2
2
4
Use indicatior Random
Name, UNI:
CSOR W4231.002  Midterm Exam Solutions
1.
i.
T
F
ii.
T
F
iii.
T
iv.
T
F
v.
T
F
F
2.
i. e)
ii. h)
3. (i) Let Xi be an indicator r.v. that takes on the value 1 if and only if (i) = i. Then
E[Xi ] = Pr[Xi = 1] = 1=n.
P
We want E[X] where X = ni=1
CSOR W4231.002 Spring, 2016
Homework 4
Out: Monday, March 21, 2016
Due: 1pm, Tuesday, March 29, 2016
Please keep your answers clear and concise. For all algorithms you suggest, you must prove correctness and give the best upper bound that you can for the
Analysis of Algorithms, I
CSOR W4231.002
Eleni Drinea
Computer Science Department
Columbia University
Thursday, March 8, 2016
Outline
1 Recap
Singlesource shortest paths in graphs with real edge
weights: a DP solution (BellmanFord)
2 An alternative form
Analysis of Algorithms, I
CSOR W4231.002
Eleni Drinea
Computer Science Department
Columbia University
Thursday, March 1, 2016
Outline
1 Recap
2 Applications of DFS
Strongly connected components
3 Shortest paths in graphs with nonnegative edge weights
(Di
Analysis of Algorithms, I
CSOR W4231.002
Eleni Drinea
Computer Science Department
Columbia University
Thursday, March 3, 2016
Outline
1 Recap
2 Shortest paths in graphs with nonnegative edge weights
(Dijkstras algorithm)
Implementations
Graphs with negat
Analysis of Algorithms, I
CSOR W4231.002
Eleni Drinea
Computer Science Department
Columbia University
Tuesday, March 22, 2016
Outline
1 Recap
2 Minimum Spanning Trees (MSTs)
Prims algorithm
Kruskals algorithm
More MST algorithms
Today
1 Recap
2 Minimum Sp
CSOR W4231.002 Spring, 2016
Homework 5
Out: Wednesday, March 30, 2016
Due: 8pm, Wednesday, April 13 , 2016
Please keep your answers clear and concise. For all algorithms you suggest, you must prove correctness and give the best upper bound that you can fo
CSOR W4231.002 Spring, 2016
Homework 3
Out: 1pm, Tuesday, February 23, 2016
Due: 1pm, Tuesday, March 8, 2016
Please keep your answers clear and concise. For all algorithms you suggest, you must prove correctness and give the best upper bound that you can
Analysis of Algorithms, I Hackathon 2016
CSOR W4231.002
Moderators: Bo Zhang, Devwrat More, Rajan Bhargava
Instructor: Eleni Drinea
Sponsored by: Eleni Drinea
Computer Science Department
Columbia University
Friday, February 26, 2016
Building a tower
Give
CS4231: Analysis of Algorithms, I
Midterm Exam Solutions, Tuesday October 21, 2014
Problem 1 [18 points, 6 points per part]
Give asymptotic solutions T(n) =(g(n) for the following recurrences. Assume that T(n)
is constant for sufficiently small n. State i
Search Trees
CS 4231, Fall 2015
Mihalis Yannakakis
1
Dictionary
Search/ Index structure
Maintain set S of items, each item has key and other info
Basic Operations:
Insert an item x
Search for an item with given key k
Other operations: empty?, size, list a