Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Solution #10
1. The clique problem is in NP: Given an instance of the problem and a proposed vertices K , we can check in polynomial time whether K has k pairwise a
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Homework #7 (due 11/21)
1. A connected graph is edgebiconnected if there is no edge whose removal disconnects the graph. Which, if either, of the following stateme
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Homework #10 (due 12/12)
1. The clique problem is dened as follows: Given a graph G and a positive integer k , does G have k pairwise adjacent vertices? (A set of k
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Homework #2 (due 10/10)
n m
1. We can recursively dene the number of combinations of m things out of n, denoted for n 1 and 0 m n, by
n m n m
,
=1 = nm1 +
n1 m1 n m
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Homework #1 (due 10/06)
1. Take the following list of functions and arrange them in ascending order of growth rate. That is, if function g (n) immediately follows f
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Theorem 1. Properties of O, , , o, Proof. P1 1. Prove f O(g ) and g O(h) f O(h). f c1 g, g c2 h, c1 , c2 R+ c3 R+
f c1 g c1 c2 h = c3 h, f O(h) 2. Prove f (g ) and g (h) f (h). f c1 g, g c2 h,
c1 , c2
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
CS300 Algorithms 2008 Fall semester M idterm Exam.
Name : I D No. : Dept. :
question 1 2 3 4 5 6 7 8 Total
score
* *Caution: Do not use Pseudo Code while describing algorithms.
(20pts) 1. Let
T be a
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
CS300 Algorithms 2008 Fall semester Midterm Solution
1
1.1 Since our algebraic decision tree T is linear, (i.e. f (x1 , x2 , , xn ) for all nodes i is linear), Lr node of T divides the space into two
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Solution #11
1. Comment: Each processor carries out the algorithm using its own number for i. Each processor has local variables sum, temp, and incr. Assume that al
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Homework #11 (due 12/18)
1. High school students have taken the college entrance exam. Using n processors write a CREW PRAM algorithm to count the number of student
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Solution #9
1. (a)
B A Start 1 B 2 A 3 A A B 4 B B 5 B A 6 A 7 A B *
Figure 1: Finite automaton (b)
f Get next text character s f A s A s f B s B s A s f A s f B s
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Homework #9 (due 12/05)
1. There are two approaches to the patternmatching problem: a nite automaton and a owchart. The nite automaton, or owchart, has three types
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Solution #8
1. (a) (b)
i. n 1 ii. mincfw_m, n i. True; By denition, a graph with connectivity 4 is 1connected, 2connected, 3connected, and 4connected, but not 5
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Homework #8 (due 11/28)
1. The connectivity of G is the minimum size of a vertex set S such that G S is disconnected or has only one vertex. A graph G is k connect
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
CS300 Algorithm Programming Assignment #1
Implementing sorting algorithms
GOAL Implement various sorting algorithms. Programming Requirements Language: only C (C+ is not allowed.) Requirements (a) Imp
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
CS300 Algorithm Programming Assignment #2
Graphrelated algorithms
GOAL Implement various graphrelated algorithms Programming Requirements Language: only C (C+ is not allowed.) Environment: Windows (
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
CC511.
Quiz
#3
2012.03.06
Student I. D.:
1.
Name:
A multiplechoice quiz consists of 10 questions, each with five possible answers of
which only one is correct. A student passes the quiz if nine or mo
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
CC511 Quiz #8
Student I. D.:
Name:
2012.04.26
1. Suppose that two independent samples from two normal populations are given as
follows: and .
Here, the problem of testing two population means are give
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
CC511. Quiz #3
2012.03.06
Student I. D.:
Name:
1. A multiplechoice quiz consists of 10 questions, each with five possibleanswers of
which only one is correct. A student passes thequiz if nine or morec
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Theorem 1. Each subgraph consisting of the edges in an equivalence class and the incident vertices forms a biconnected component. Proof. Assume that the subgraph does not form a biconnected component.
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Theorem 1. If M (n) c log(n) and c > 0, then T (n) = O(n), where T (n) = 2T Proof. T (n) = 2T n + M (n) 2 n < 2T + c log n 2 n n < 2 2T 2 + c log + c log n 2 2 < . . . n n n n < 2k T k + c 2k1 log k1
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Theorem 1. Let a, b, c, d R. Then the solution to the recurrence equation T (n) = for n = ck is the following: if a < c O(n) O(n log n) if a = c T (n) = O(nlogc a ) if a > c And theorem holds even if
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Theorem 1. The intersection of a nite number of convex sets is also convex. Proof. 1. Let A, B be two convex sets. Take any pair of elements p, q such that p, q A B . Since A is convex, by denition, p
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
CS300 Algorithm Programming Assignment #3
GOAL I mplement Kruskals MST algorithm and BoyerMoore string matching algorithm
Programming Requirements Language: only C (C+ is not allowed.) Environment (1
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Solution #6
1. (a) Function oneofksmallest(A: array, n, k: integer):integer; min :=A[1] for i=2 to nk+1 do if A[i] < min then min := A[i] end if end for return
Korea Advanced Institute of Science and Technology
Algorithm and analysis
COMPUTER S cs300

Spring 2008
Fall Semester 2008 CS300 Algorithms
Homework #6 (due 11/14)
1. (a) You are given n keys and an integer k such that 1k n. Give an ecient algorithm to nd any one of the k smallest keys. (For example, if