Computer Science 373 Analysis of Algorithms
Prof. Steven Skiena
Spring 2014
Homework 2 Sorting
Due Tuesday, March 11, 2014
Each of the problems should be solved on a separate sheet of paper to facilitate grading. Limit
the solution of each problem to one
CSE 373 Analysis of Algorithms
April 29, 2014
Solutions to Midterm 2
P ROBLEM 1
(a) On addition of a constant c > 0 to each edge, the minimum spanning tree remains the
same. This is because the ordering of edges would still remain the same and hence Krusk
CSE 373 Analysis of Algorithms
May 14, 2014
Solutions to HW 5
P ROBLEM 1
[Implementation of Edit-Distance.]
P ROBLEM 2
[83]
(a) Say we are given strings A and B of lengths n and m. Then for every i,j, 1 i n, and
1 j m, we need to know what is the longest
CSE 373 Analysis of Algorithms
March 11, 2014
Solutions to Midterm 1
P ROBLEM 1
[1] lg lg n < ln n, lg n < (lg n)2 <
2n , 2n1 < en < n!
n < n < n lg n < n1+ < n2 , n2 + lg n < n3 < n n3 + 7n5 <
[2]
f (n) = O(g(n) c1 , n > n1 , f (n) c1 g(n)
g(n) = O(h(n)
CSE 373 Analysis of Algorithms
April 6, 2014
Solutions to HW 3
P ROBLEM 1
[54] Let T be the BFS-tree of the graph G. For any e in G and e T , we have to show that e
/
is a cross edge. Suppose not, suppose e = (x, y) is not a cross edge. Wlog, say x is an
Computer Science 373 Analysis of Algorithms
Prof. Steven Skiena
Spring 2014
Homework 5 Dynamic Programming and Intractability
Due Thursday May 8, 2014
Each of the problems should be solved on a separate sheet of paper to facilitate grading. Limit
the solu
Computer Science 373 Analysis of Algorithms
Prof. Steven Skiena
Spring 2014
Homework 3 Graph algorithms
Due Thursday April 3, 2014
Each of the problems should be solved on a separate sheet of paper to facilitate grading. Limit
the solution of each problem
CSE 373 Analysis of Algorithms
February 26, 2014
Solutions to HW 1
Steven Skiena
P ROBLEM 1
[117] Base case: When we have n = 1 vertex, then we have 0 = n 1 edges.
Inductive step: Assume for n = k, we have k 1 edges. To show that for n = k + 1, we have
k
CSE 373 Analysis of Algorithms
March 11, 2014
Solutions to HW 2
P ROBLEM 1
[41] Sort the players by their values. The rst n players are Team 1, the rest are Team 2.
[42] a) Find the maximum and minimum element in the array in O(n) time and output their
di