Analysis and Design of Algorithms
Analysis and Design of Algorithms
Q.2 [A] For a given graph, after performing all the iterations of ALL PAIRS [2]
SHORTEST PATH algorithm, the obtained output is shown as the final
Distance Matrix D and the Parent Matrix P. Using these matrices, trace out
the shortest path along with explanation (strictly using Matrix P) for the
following pairs of vertices.
1. From vertex 5 to 1.
2. From vertex 2 to 3
1
Q.2 [B] Given a chain of six matrices A, B, C, D, E and F with P0 = 4, P1 = 1, P2 = [4]
1, P3 = 4 and P4 = 1, P5 = 1 and P6 = 3. Find m[1,6]. Also find the optimal
parenthesization of a matrix-chain product.
OR
Q.2 [B] Solve the following assembly line scheduling problem using dynamic [4]
programming :
Q.2 [C] Solve LCS problem using dynamic programming for the given strings s1 = [4]
{C, O, M, P, U, T, E, R} and s2= {A, C, M, N, O, M, W, T, U, E, O, R}.
OR
Q.2 [C] Solve the following instance of the knapsack problem using dynamic [4]
programming, n = 5, W = 11 units, (w1, w2, w3, w4, w5) = (3, 4, 5, 9, 4) and
(v1, v2, v3, v4, v5) = (3, 4, 4, 10, 4)
*************