2002 S

219,302pages on
this wiki
Add New Page
Discuss this page0 Share

1. (10%) Let A [1..n] be an array storing all the student identification numbers of all current students is Tsing Hua University. Give an O(n) time algorithm to sort the element of A.

2. (10%) The Fibonacci numbers are defined by the following recurrence:

F_0 = 0,
F_1 = 1,
F_i = F_{i-1}+F_{i-2} , for i≧2,
Derive an explicit expression for F_i.

3. (15%) In the longest-common-subsequence problem, we are given two sequences A=[a_1, a_2, ..., a_m] and B=[b_1, b_2, ..., b_m], and wish to find a maximum-length common subsequence X of A and B.(Please clearly define your notation.)

(1) (5%) Describe a dynamic-programming algorithm to find the maximum-length common subsequence X of A and B.(Please clearly define your notation.)
(2) (5%) analyze the running time and space requirements of your algorithms (in terms of big-O notation).
(3) (5%) If we only want to find the length of X, what is the space requirement? Why?

4. (10%)

(a) (5%) Describe the Floyd-Warshall algorithm to compute the weights of the all-pairs shortest paths on a directed graph G=(V, E), What is the time complexity of this algorithm? Why?
(b) (5%) Give an algorithm to determine the all-pairs shortest paths via constructing the predecessor matrix Π from the intermediate results in (a). What is the complexity of this algorithm? Why?

5. (10%) Let G(V,E) be an undirected, connected graph with weight function w : E→R, and suppose that |E|≧|V|. Given an efficient algorithm to compute the second-best minimum spanning tree of G.

6. (10%)

(a) (5%) Describe the Strassen’s algorithms for matrix multiplication.
(b) (5%) Derive the time complexity of applying this algorithm to multiply two n×n matrices.

7. (5%) Explain why the following statement is wrong and provide your own correct version. ”NP” stands for the set of problems that cannot be solved in polynomial time in its worst case, therefore P∩NP=Ø.”

8. (15%) The Fast Fourier Transform(FFT) problem is to calculate the following:

A_j= \sum_{0 \leq K \leq N-1} a_k e^{ \frac{2 \pi ijk}{n} }, 0 \leq j \leq n-1

Where i=\sqrt{-1}, and a_0, a_1, ..., a_{n-1} are given numbers. We also know that

e^{ix}= e^{i(x+a \pi}) if a is even
-e^{i(x+a \pi}) if a is odd

Describe an algorithm that solves the FFT problem using the divide-and-conquer strategy. Also explain why its time complexity is O(n log n)

9. (15%) The following is the definition of the Bin Packing problem. Bin Packing: There are n items with sizes S_1, S_2, ..., S_n, where 0≦Si≧1. We want to pack the items in bins where each bin has a capacity of 1. The Bin Packing problem is to determine the minimum number of bins necessary to pack all items. We also know that the Partition problem (described below) is NP-complete. Prove that the Bin Packing Problem is NP-hard by transforming to or from the Partition problem. The Partition Problem is : Partition: Let a finite set A be given, where each has size s(a) in positive integers. Is there a subset such that the subset A’ contains exactly half of the total size, i.e,

\sum_{a \in A} s(a)= \sum_{a \in A-A'} s(a)?

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random wikia