# 2003 S

*219,603*pages on

this wiki

1. (15%) Answer the following questions.

- (a) (5%) Find an asymptotic upper bound on .
- (b) (5%) Find the asymptotic tight bound of , namely, Θ().
- (c) (5%) Assume n is a power of two and f(1)=1. Find the asymptotic tight bound of f(n), where f(n)=2f(n/2)+nlogn.

2. (10%) Given an m*n array of numbers where each row of n numbers are sorted in increasing order from left to right.

- (a) (5%) Show that if we wort the numbers in each column in increasing order from top to bottom, then the rows are still kept sorted in increasing order from left to right.
- (b) (5%) Will the rows still be in increasing order from left to right if the columns are sorted in decreasing order from top to bottom?

3. (10%) Suppose we modify the typical merge sort algorithm to divide the n-element sequence in three subsequences of sizes , , and , respectively, sort each subsequence and merge the three sorted subsequences recursively to produce the sorted answer. Please give a formal description of this new algorithm, and estimate its time-complexity.

4. (10%) Let X=<> and Y=<> be two sequences. Let be and be , where i≥1 and j≥1. ( is empty for i>n and is empty for j>m.) For each (i,j), let us define L() to be the length of an LCS (longest common subsequence) of and .

- (a) (5%) Give a recursive formula for L().
- (b) (5%) Give an algorithm for computing L(X,Y).

5. (10%)

- (a) (6%) Describe an efficient algorithm that, given an undirected graph G, determines a spanning tree of G whose largest edge is minimum over all spanning trees of G.

(b) (4%) Analyze the time complexity of your algorithm for (a).

6. (5%) Let G=(V,E) be a flow network such that the capacities of all edges are integers. Show that the Ford-Fulkerson method for finding the maximum flow of G requires O(m|E|)time, where m is the value of the maximum of G.

7. (10%) How quickly can you multiply a kn*n matrix by an n*kn matrix, using Strassen's algorithm as a subroutine?

8. (10%) Muptiplying two n-bit numbers u and v straightforwardly requires O() steps. Using divide-and-conquer, we ca split each number into two equal parts and compute the product by the following method:

- uv=(a+b)(c+d)=ac + (ad+bc)+bd.

If ad+bc is computed as (a+b)(c+d)-ac-bd. What is the computing time?

9. (10%)

- (a) (5%) Describe Dijkstra's algorithm that solves the single-source shortest-paths problem on a weighted, directed graph G=(V,E), in which all edge weights are nonegative.
- (b) (5%) Whos why Dijkstra's algorithm will not work properly when negative edge weight exists.

10. (10%) A k-coloring of an undirected graph G=(V,E) is to assign one of the k colors to each vertex such that no adjacent vertices have the same color. The k-coloring problem is to determine whether a given graphs can be 3-colored. If the 3-coloring problem is NP-hard, show that the 4-coloring problem is also NP-hard.