CS300 Assignment6
CS300 Assignment6
Yunajeong
Assignment 6 Due: 2024.06.02 23:59:00
2024 Spring CS300 TA: Kyounga Woo ([email protected])
• Assignment submitted one (1) day after the assignment deadline will be accepted with 20%
deduction on corresponding assignment grade.
• Assignment submitted more than one (1) day late will not be accepted.
Using algorithm 1, you are going to solve the minimum cost for chain matrix multiplication for
five matrices, A1 . . . A5 .
The size of the matrices are given as follows:
A1 = 2 ⇥ 9, A2 = 9 ⇥ 30, A3 = 30 ⇥ 6, A4 = 6 ⇥ 7, A5 = 7 ⇥ 4
(a) (30 points) Calculate the subtree C(i, j) and the split point k by filling the tables. The class
lecture (“example” VOD on week 11) will be helpful to fill the table.
(1) The table 1, denotes the number of the matrix multiplications for each subtree C(i, j),
where C(i, j) = number of matrix multiplications of j i (2 points per each blank).
(2) The table 2 is the last split point k when combining two subtree (1 point per each
blank).
1
20230672
Yunajeong
Assignment 6 Due: 2024.06.02 23:59:00
2024 Spring CS300 TA: Kyounga Woo ([email protected])
(b) (3 points) Write down the minimum cost and the corresponding optimal parenthesization.
π(
Optimal Parenthesization: A1 A)2 A3 A4 A5
) ) ) d
(c) (2 points) What is the running time for algorithm 1?
(a) O(n)
(b) O(n2 )
(c) O(n2 log(n))
V
(d) O(n3 )
2
20230672
Yunajeong
(Each blank 0.25 point) For below graph, apply algorithm 2 and fill the matrices. The outermost
loop visits vertex in an alphabetical order. The initialized matrix is given to you. The edge
direction is from the row to the column.
MB A B C D E MC A B C D E
A 0 ∞ I g ∞ A 0 5 ∞
12
0
B 3 0 2 2 ∞ - -
B 3 0 -
3 ∞
C 1 4 0 - ∞ C 1 4 0 ㅓ ∞
D n 0 3 D 6 0 3
1 얼
6 ∞
E L O ㆁ 0 E - o 0
3
20230672
Yunajeong
Assignment 6 Due: 2024.06.02 23:59:00
2024 Spring CS300 TA: Kyounga Woo ([email protected])
MD A B C D E ME A B C D E
A 0 5 1 O 3 A 0 ω
B 3 0
C
D 6
1 4 0
∞ 서
- α O
쭈
0
O
2
B
B
C
D
-
5
β 0
4 층으로 홀
0
0
O
E ㆁ 0 E -
1 L O 0
4
20230672
Yunajeong
(b) (3 points) Assuming P 6= NP, what is the running time of the optimal algorithm finding a
maximum independent set of a graph? (4)
(1) O(n)
(2) O(n log n)
(3) O(n2 )
√
(4) None of above.
(c) (3 points) Find the largest independent set for below tree. If there are multiple largest inde-
pendent set, write one of them.
(d) (3 points) Assuming P 6= NP, what is the running time of the optimal algorithm finding a
maximum independent set of a tree? ( ?
√
(1) O(n)
(2) O(n log n)
(3) O(n2 )
(4) None of above.
5
20230672
Yunajeong
(b-c) The formula satisfiability problem (SAT) is a boolean formula that consists variables
(x1 , x2 , . . . ), operators (¬, ^, _, =) ), and parentheses. You are going to show that SAT is a
NP-complete.
(c) (7 points) Show that SAT is NP-hard by reducing the circuit satisfiability problem. Include
the preprocess, application of the algorithm, and postprocess when performing reduction.
oshowtuatSAT또 NP-
hart , we reduce the civcut
satsfcablityproblem [ CircuiTSAr )toSA