Thursday 16 February 2017

Assignment 2

1. "Greedy Algorithms are used to solve optimization problems." Explain it with an example.
2. An undirected graph G(V, E) contains n ( n > 2 ) nodes named v1 , v2 ,….vn. Two nodes vi , vj are connected if and only if 0 < |i – j| <= 2. Each edge (vi, vj ) is assigned a weight i + j. A sample graph with n = 4 is shown below. What will be the cost of the minimum spanning tree (MST) of such a graph with n nodes? (GATE CS 2011) gate_2011_4
A
1/12(11n^2 – 5n)
B
n^2 – n + 1
C
6n – 11
D
2n+1
3. Create MST by primes and kruskal's algorithm
gate_2006
4. Explain Drawbacks of Dynamic programming and greedy method.
5. Given a chain of  matrices <5,4,6,2,7>  find optimal parenthesization of matrix chain product.
6. Find Longest common subsequence of "human" and "chimpanzee".
7. Explain lower Bound Theory.
8. Solve by using fractional and 0/1 Knapsack problem,
i) Knapsack Capacity W = 25 and
ItemABCD
Price12995
Size2410107
ii) where Knapsack Capacity W = 30 and
ItemABCD
Value501406060
Size5201012
Ratio10765