Analysis of Algorithms
Solutions to Problem Set #3
Problem 1 (graded by Dan, 18 points)
1.
Let A be a matrix with no duplicates and let be the permutation of its elements such
that A[ (1)] < A[ (2)] < . . . < A[ (n)]. Suppose that there is a correct algor
Analysis of Algorithms
Solutions to Problem Set #4
Problem 1. Graded by Mi.
First we sort the points in increasing order. We then use a greedy algorithm. As
the rst interval, we pick the unit interval that starts at the rst (smallest) point.
This interval
Analysis of Algorithms
Solutions to Problem Set #6
Problem 1, graded by Mengqi.
a.
Consider the following graph:
s
3
a
9
0
b
1
c
10
g
f
18
In the rst step, node s and its edges (s, a) and (s, f ) are processed, so the d[a]
value for node a is updated to 3
Analysis of Algorithms
Solutions to Problem Set #5
Problem 1, graded by Tao.
We can scan the adjacency lists of the graph G and construct a list L that contains
a pair (C [u], C [v ]) for every edge (u, v ) of G connecting two vertices that are not in
the