0% found this document useful (0 votes)
22 views2 pages

Daa Questions

DAA QUESTION PAPER

Uploaded by

kanishkk070
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Daa Questions

DAA QUESTION PAPER

Uploaded by

kanishkk070
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
BML MUNJAL IVERSITY. : = 3 END-SEM EXAMINATION ~ MAY 2019 Course:- CSE2012 - Design and Analysis of Algorithms Programme: B.Tech (GSC/CSE) Semester: IV Duration: 3 Hrs Max. Marks: 60 Weightage: 40% Instructions: > All Questions are compulsory. > Start each answer on a fresh page and number your answers clearly. Answer all parts of the same Question together and in sequence. > Calculator is not required. a4. | Consider the following weighted graph. Represent the graph with a suitable data structure. Apply Prim's algorithm to find the minimum spanning tree. As you proceed, show the status of the priority queue at A | each step as you grow the partial tree to a full solution. B | Given a weighted connected directed graph in the form of a square weight matrix W. All weights are positive. Write an algorithm that will generete a square binary matrix B having the same dimension as | » marks W. The matrix B will have @ one (1) for entry (Ij) if there is @ path from node / to node J in the graph. Otherwise, the entry will be a zero (0) ‘Comment on the time and space complexity of your solution. © | Design a divide and conquer algorithm to find the maximum and minimum of an unsorted array of n | (+25 elements. Analyze the time complexity of the algorithm and show that itis better than the brute force | marks method. D | With suitable example, explain how a non-deterministic alaonithm differs from @ deterministic algorithm. | § marks 2. | i) Consider the following sequence of matrices A B C D E whose dimensions are 4x5, 5x3, 3x2, 2x7 and 7x2 respectively, sierra How many different ways are there to compute the product of the given § matrices? Provide a ‘dynamic programming solution for finding the optimal parenthesization of the given sequence of matrices. marks [Tif im Boyar-Moore aking matching algorithm, a pattem is preprocessed before being matched with a | given text. Write the algorithm for preprocessing the pattern. Also state and justify the worst case time complexity of the algorithm. a3. | ii) Compute the nih Fibonacci number by writing two algorithms as Tolows — 2) a recursive algorithm without using dynamic programming b) a dynamic programming algorithm with memoization. Crically comment on the time requirements of both the approsches end justify that memoization approach is far better in reducing the time required for finding the solution. Explain how Becktracking, as a general problem solving approach, can be used to cope with computationally hard problems. You must cite suitable example (e.g. N-queen problem) and discuss in the context of that example problem. (5+5)=10 marks ii) Union-Find algorithm is a wellknown approach for representing disjoint set data structures. Discuss in detail, how different sets can be represented and various operations (e.g. makeset, union, find) can be performed in those sets. Clearly explain the time complexity of each of the operations. ‘A sequence of ten square matrices, each having dimension nxn for n=2k (k is a positive integer), is to be multiplied. Propose a divide and conquer algorithm for accomplishing the task. Analyze the time complexity by stating the recurrence. 5+(942)=10 as| i How do we prove the correctness of a loop in an algorithm? Justify by stating all the necessary properties in the context of the following problem — find the sum of all the elements of an array of integers. State the Vertex cover problem and prove thet Vertex-cover is NP-complete. 5+5=10

You might also like