# 2003 S

226,711pages on
this wiki

1. (15%) Answer the following questions.

(a) (5%) Find an asymptotic upper bound on $\sum_{i=1}^{\infty} \frac{i^2}{2^i}$.
(b) (5%) Find the asymptotic tight bound of $\sum_{i=1}^{n} \lfloor log_2 i \rfloor$, namely, Θ($\sum_{i=1}^{n} \lfloor log_2 i \rfloor$).
(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 $\lfloor \frac{n}{3} \rfloor$, $\lfloor \frac{n+1}{3} \rfloor$, and $\lfloor \frac{n}{3} \rfloor$, 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=<$x_1, x_2, ..., x_n$> and Y=<$y_1, y_2, ..., y_m$> be two sequences. Let $X_i$ be $x_i, x_{i+1}, ..., x_n$ and $Y_j$ be $y_j, y_{j+1}, ..., y_m$, where i≥1 and j≥1. ($X_i$ is empty for i>n and $Y_j$ is empty for j>m.) For each (i,j), let us define L($X_i, Y_j$) to be the length of an LCS (longest common subsequence) of $X_i$ and $Y_j$.

(a) (5%) Give a recursive formula for L($X_i, Y_j$).
(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($n^2$) steps. Using divide-and-conquer, we ca split each number into two equal parts and compute the product by the following method:

uv=(a$2^{n/2}$+b)(c$2^{n/2}$+d)=ac$2^{n}$ + (ad+bc)$2^{n/2}$+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.