21-22 Daa
21-22 Daa
Roll. No:
General Instructions:
1. The question paper comprises three sections, A, B, and C. You are expected to answer them as directed.
2. Section A - Question No- 1 is 1 marker & Question No- 2 carries 2 mark each.
3. Section B - Question No-3 is based on external choice carrying 6 marks each.
4. Section C - Questions No. 4-8 are within unit choice questions carrying 10 marks each.
5. No sheet should be left blank. Any written material after a blank sheet will not be evaluated/checked.
SECTION A 20
1. Attempt all parts:-
1-a. The worst case complexity for insertion sort is (CO1) 1
(a) O(n)
(b) O(log n)
(c) O(nlog n)
(d) O(n2)
1-b. Suppose we are sorting an array of eight integers using heapsort, and we have just finished 1
some heapify (either maxheapify or minheapify) operations. The array now looks like this:
16 14 15 10 12 27 28 How many heapify operations have been performed on root of
heap? (CO1)
(a) 1
(b) 2
(c) 3 or 4
(d) 5 or 6
1-c. No of fields in a node of Binomial heap are (CO2) 1
(a) 4
(b) 5
(c) 6
(d) 7
1-d. Given a heap of n nodes, the maximum number of tree for building the heap is (CO2) 1
(a) n
(b) n-1
(c) n/2
(d) log n
1-e. We can solve Single-Source shortest path problem using (CO3) 1
(a) Kruskal's Algorithm
(b) Prim's Algorithm
(c) Dijkstra's Algorithm
(d) Flyod-Warshal Algorithm
1-f. For dense graph which of the following statement is true (CO3) 1
(a) V = E^2
(b) E < |V|
Page 1 of 4
(c) E = 2 |V|
(d) E = V^2
1-g. If an optimal solution can be created for a problem by constructing optimal solutions for its 1
subproblems, the problem possesses ____________ property. (CO4)
(a) Overlapping subproblems
(b) Optimal substructure
(c) Memoization
(d) Greedy
1-h. Which of the following is true about the time complexity of the recursive solution of the 1
subset sum problem? (CO4)
(a) It has an exponential time complexity
(b) It has a linear time complexity
(c) It has a logarithmic time complexity
(d) it has a time complexity of O(n2)
1-i. Problems that can be solved in polynomial time are known as? (CO5) 1
(a) intractable
(b) tractable
(c) decision
(d) complete
1-j. A randomized algorithm uses random bits as input inorder to achieve a _____________ 1
good performance over all possible choice of random bits. (CO5)
(a) worst case
(b) best case
(c) average case
(d) none of the mentioned
2. Attempt all parts:-
2.a. Rank the following functions according to their order of growth. (CO1) 2
n2, n, lgn, nlgn, n! , 2n, n1/2 ,nn, n2logn
2.b. Discuss the applications of Fibonacci Heap (CO2) 2
2.c. Explain different types of edges obtained during DFS Traversal on a directed graph (CO3) 2
2.d. Explain N-Queen problem with its complexity? (CO4) 2
2.e. Explain Approximation Algorithm. (CO5) 2
SECTION B 30
3. Answer any five of the following:-
3-a. Solve the following recurrence relation using master's theorem (CO1) 6
T(n) = 7T(n/2) + 3n2 + 2
3-b. What is a priority queue? Explain key operations of priority queue With the help of an 6
example. (CO1)
3-c. Insert the nodes 15, 13, 12, 16, 19, 23, 5, 8 into empty Red Black Tree (CO2) 6
3-d. Explain the algorithm to delete a given element in a binomial Heap. Give an example for the 6
same. (CO2)
3.e. Write algorithm to solve fractional knapsack problem. For the given items, find the optimal 6
solution: W: <6, 2, 4, 3, 5>, P: <12, 10, 9, 9, 5>, capacity of knapsack = 10 (CO3)
3.f. Find Longest Common Subsequence of sequences "ALLIGATOR" and "ALGORITHM" 6
using dynamic programming. (CO4)
3.g. What is randomized algorithms? Explain the concept behind randomized algorithms? (CO5) 6
Page 2 of 4
SECTION C 50
6-b. Implement Prim's algorithm to find minimum spanning tree. Analyze its time complexity. 10
Find MST of the given graph using Prim's algorithm. (CO3)
Question Instruction
Page 3 of 4
7. Answer any one of the following:-
7-a. Consider the sum-of-subset problem, n = 4, Sum = 13, and w1 = 3, w2 = 4, w3 = 5 and w4 = 10
6. Find a solution to the problem using backtracking. Show the state-space tree leading to the
solution. (CO4)
7-b. Solve the instance of 0/1 knapsack problem using dynamic Programming : n = 4, M = 25, 10
(P1, P2, P3 P4) = (10, 12, 14, 16), (W1, W2, W3, W4) = (9, 8, 12, 14) (CO4)
8. Answer any one of the following:-
8-a. Define the following problems related to NPC: (CO5) 10
(i) Vertex Cover
(ii) Clique
(iii) SAT and its variants
8-b. Explain the KMP String matching algorithm for finding the pattern on a text and analyze the 10
algorithm. (CO5)
Page 4 of 4