Korea Advanced Institute of Science and Technology
Algorithm and analysis
CS 300

Spring 2008
CC511 uiz #7
2012.04.19
Student I. D.: Name:
1. Let X 1: 1, ~,n be independent normal random variables, having mean it and
Iknown variance 02 Here, we have a problem of testing
H0 : a: lo versus H1 1 #9E 150
Then, describe the probability of accepting
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
Homework #10 Solution
1.
Minimum negative cycle
Let D[i][ j][k] be shortest path from vertex i to vertex j with k edges at most. Perform this algorithm :
(initially every elements in D is INF)
For k 1 to V:
For every edges E(u,v):
D[w][v][k] = D[w][v][k
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
Homework 6 solution
15.52 (skip)
Log cutting
Let the left end point be L0 , and Lk+1 = . Then we build a table M[0k+1, 0k+1] of size O(k 2 ),
which of each element M[i, j] contains the minimum cost of cutting the sublog, starting from Li
to Lj . Then,
M
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
Homework#5 Solution!
9.11
We can compare the elements in a tournament fashion  we split them into pairs, compare each
pair and then proceed to compare the winners in the same fashion. We need to keep track of
each "match" the potential winners have part
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
Modify a line of Partition(A, p, r)
if A[y] x into if A[y] x
During the operation of Partition, values not greater then x are in the first partition, values greater
then x are in the second partition. Since all elements have the same value, which means no
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
1.
Use the divideandconquer approach to write an algorithm that finds the largest item in a
list of items. Analyze your algorithm, and show the results in order notation.
Answer) If you sort the list first, then you get ( ), which is worse than sequenti
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
2014 FALL CS300
HW1 Solutions
2.13 linear search
pseudocode example:
Linear( A, n, v )
1
index < NIL
2
i < 1
3
while ( i <= n ) do
4
if ( A[i] = v ) then
5
index < i
6
end if
7
i < i+1
8
end while
9
return index
loop invariant: if A[1,i1] has v, the
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
CS300 Homework #12
You will not need to submit homework next week. Keep up the good work with your
programming assignment and prepare yourself for the finals!
Problems[34.41, 34.45, 34.51, 34.58] will be discussed in the class.
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
CS300 Homework #8 (due 11/10 23:59PM)
Submit your answers for the selected problems [22.24, 24.36, 24.37]
Problems[22.26, 22.28, 24.33, 24.35] will be discussed in the class.
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
CS300 Homework #11 (due 12/11 11:59 PM)
Submit your answers for the selected problems [2, 4]
Problems [1, 3, 5, 6] will be discussed in the class.
Problem1
Problem2
Problem3
Suppose that someone gives you a polynomialtime algorithm to decide formula sati
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
CS300 Homework #10 (Due: 12/1 11:59 PM)
Submit your answers for the selected problems : [2, 3]
Problems [1, 4, 5, 6] will be discussed in the class
1.
Minimum negative cycle
For given graph G, give an efficient algorithm to find the length(number of edges
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
CS300 Homework #4 Solution
6.26.
Consider a heap of n nodes where the root node has been changed to contain the smallest
value of all the nodes. Now when we call MAXHEAPIFY on the root, the value will have to
be exchanged down with its child at every le
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
Solutions of CS300 Homework #9
1.
A mixed graph is graph in which some of the edges are directed and some of the edges are
undirected. If a given mixed graph G has no directed cycle, then it is always possible to orient
the remaining undirected edges so t
Korea Advanced Institute of Science and Technology
Algorithm and analysis
CS 300

Spring 2008
CC511 uiz #8
2011.11.28
Student I. D.: Name:
1. Let Xvi: 1,,n be independent normal random variables, having mean u and
known variance o2. Here, we have a problem of testing
H0 : y=p0 versus 1111:1155 .410.
Then, describe the probability of rejecting H9
Korea Advanced Institute of Science and Technology
Algorithm and analysis
CS 300

Spring 2008
CC511 Quiz #1
Student I. D.: Name:
2012.02.16
1. Two fair dice are thrown, one red and one blue. Then, calculate
P(sum of scores is 7 either die is 6).
(I 6,; (226) (776)C4.6) (12.61 (are) my (6U)
(m; (9.27kb I)
Z 7,
:12.
4t ,
I Jig
l
l
q
3 r U A E
2
Korea Advanced Institute of Science and Technology
Algorithm and analysis
CS 300

Spring 2008
CC511 uiz #5
2012.03.20
Student I. D.1 Name:
1. Let Xi ~ Nanci), 2': 1, ,n be independent normal random variables. Then,
show that
zlxpmm, 210:).
i= i=1 1?:
Here, note that X,(t)=e
X12
r' " (3461:1511
95m) = like): Ti /
I;
14+ aft'l2
F lu' )
" . XNN(i/M
Korea Advanced Institute of Science and Technology
Algorithm and analysis
CS 300

Spring 2008
CC511 uiz #4
2011.10.10
Student I. 13.: Name:
1. A series system is one that needs all of its components to function in order for the
system itself to be functional. For an ncomponent series system in which the
component lifetimes are independent exponent
Korea Advanced Institute of Science and Technology
Algorithm and analysis
CS 300

Spring 2008
CC511 Quiz #10
2012.05.10
Student I. D.: Name:
1. The data are generated by a simple linear equation:
y, =0+1wi+ev i: 1, ,n , where 55 ~ N(0,02)
The estimators of ,60 and ,61 are determined by minimizing
SSE: E (yi _ ruwiie)?
I'= 1
Asa result, we get th
Korea Advanced Institute of Science and Technology
Algorithm and analysis
CS 300

Spring 2008
CC511 Quiz #7
2011.11.11
Student I. D.: Name:
1. Let Xi, i = 1, ~37; be independent normal random variables, having mean ,u, and
variance 02. For an estimator of ii, the sample mean defined by
_ 1 n
n 1231 a
is used. Then, show that a 100(1~a)% confidence
Korea Advanced Institute of Science and Technology
Algorithm and analysis
CS 300

Spring 2008
CC511 uiz #9
Student I. D.: Name:
2012.05.03
1. Let Xij ~ N(p,;,02), 2': 1,~,m, and j: 1,,n be independent random variables.
Then, suggest an unbiased estimator of a2.
7me M66 = 99E"! x 6A (HT'M
(\va W . (17:7an
E 2515 J * T
Tm H O ( EMCznTrwl) "
Korea Advanced Institute of Science and Technology
Algorithm and analysis
CS 300

Spring 2008
CC511 Quiz #4
Student I. D.: Name:
1. A series system is one that needs all of its components to function in order for the
system itself to be functional. For an ncomponent series system in which the
component lifetimes are independent exponential random
Korea Advanced Institute of Science and Technology
Algorithm and analysis
CS 300

Spring 2008
CC511 Quiz #6
Student I. D.: Name:
2012.04.12
1. Consider a set of independent observations $1,352, u,a:, that have a Poisson
distribution with an unknown parameter A. Then, show that the maximum likelihood
estimate of A is determined by
A: E,
where E re
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
Since we didnt have enough time to properly discuss about problems 34.41 and 34.58, I will
upload brief explanations for these problems.
34.41
It might be difficult to even understand the problem without carefully reading the proof of
Theorem 34.9 of t
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
CS300 Homework #8 Solutions
22.24
The correctness proof for the BFS algorithm shows that d[u] = (s, u), and the algorithm doesnt
assume that the adjacency lists are in any particular order. Therefore, d[u] is independent of the
order in which the vertice
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
CS300 Homework #7 (due 11/03 11:59 PM)
Submit your answers for the selected problems [2,22.17]
Problems [1,3,4,22.15] will be discussed in the class.
1.
Suppose that we have a set of activities to schedule among a large number of lecture halls,
where an
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
CS300 Homework #9 (Due: 11/17 11:59PM)
Submit your answers for the selected problems: [246]
Problems [1, 2, 24.16, 243] will be discussed in the class.
1.
A mixed graph is graph in which some of the edges are directed and some of the edges are
undirect
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Fall 2014
CS300 Homework #3 (due 9/29 23:59PM)
Submit your answers for the selected problems [7.14, 7.22, 7.32]
Problems[7.25, 7.44, 7.46] will be discussed in the class.
n
Note: E[T(n)] = E[T(p)] + E[T(n p)] + (n) 2E [T ( )] + (n)
2
Korea Advanced Institute of Science and Technology
Algorithms
CS 300

Spring 2010
Heapsort
Heap Definition
Nearly Complete Binary Tree
(All levels are completely filled except possibly the lowest,
which is filled from the left up to a point.)
The value of each node each of the node's children.
Maximum is at root.
Heap Data Structure
Ne