III year B.Tech. – Computer Science & Engineering rd
Design and Analysis of Algorithms
Duration: 3:00 hrs Max Marks: 100 Note: - Attempt all questions. All Questions carry equal marks. In case of any ambiguity or missing data, the same may be assumed and state the assumption made in the answer.
Q 1. Answer any four parts of the following. 5x4=20
a) Multiply the following two matrices using Strassen’s Matrix Multiplication Algorithm. 6 8 2 5 𝐴=[ ] 𝐵=[ ] 9 7 3 6 b) State Master’s Theorem. Find the solution to the following recurrence equation using master’s theorem. i) T (n) = 2T (n/2)+ n log n ii) T (n) = 2nT (n/2) + nn c) Find the minimum and maximum height of any AVL-tree with 11 nodes. Assume that height of the root is 0. d) What are greedy algorithms? What are their characteristics? Explain any greedy algorithm with example. e) Define Hamiltonian cycle. Check whether the Hamiltonian cycle exists for the graph given below. f) Explain Kruskal’s algorithm to compute the minimum cost spanning tree. Q 2. Answer any four parts of the following. 5x4=20 a) Give a control abstraction for Divide and Conquer method. Explain with an example. b) Explain the Knapsack problem with an example? c) Show that the following equalities are incorrect with suitable notations i) 10n2+9 = O(n) ii) n2log n = Ɵ(n2) d) Using Recursion Tree method, solve. Assume constant time for small values of n. T(n)= 2T(n/10)+ T(9n/10)+n e) What is traveling salesman problem? Implement it for the following matrix. 0 8 16 15 14 0 9 12 7 10 0 6 11 13 10 0 f) Prove that P ⊆ NP. Q 3. Answer any two parts of the following. 10x2= 20 a) Explain the concept of Backtracking. Explain how 4 Queen problem can be solved using backtracking. Draw the state space tree corresponding to 4 Queen problem. b) Write the algorithm for quick sort. Provide a complete analysis of quick sort for the given set of numbers 12, 33, 23, 43, 44, 55, 64, 77, and 76. c) Discuss the approximation algorithms for NP-hard problems. Q 4. Answer any two parts of the following. 10x2= 20 a) Find the optimal solution using branch and bound for the following assignment problem. Job 1 Job 2 Job 3 Job 4 A 9 2 7 8 B 6 4 3 7 C 5 8 1 8 D 7 6 9 4 b) Explain how dynamic programming can be used to solve matrix chain multiplication. Apply the algorithm to multiply the following: 3 Matrices, <M1, M2, M3> with dimensions <(15,3), (3, 10), (10, 2)> c) Write short notes on. i) Deterministic Algorithm and Non-Deterministic Algorithm ii) Ford- Fulkerson method Q 5. Answer any two parts of the following. 10x2= 20 a) Explain the term ‘polynomial time reduction’. Explain how the clique problem can be transformed to the vertex cover problem. b) Construct a red-black tree by inserting the keys 41, 38,31,12,19,8 into an initially empty tree. Then show the red-black trees that result from the successive deletion of the keys in the order 8, 12, 1, 41. c) Differentiate between Kruskal’s and Prim’s algorithm. Apply the greedy technique to find the minimum spanning tree using Prim’s algorithm for the given graph.