DAA 6TH.pyq
DAA 6TH.pyq
Note: There
marks.
are only objective type questions and attempt all questions. All questions carry equal marks i.e. 2.5
Q1. What should be outcome of following given recursive code of program as fig-01-?
#include<stdio.h>
int fun(int i)
if (i>0)
return i+2+fun(--i) +fun(i--);
return fun(i/2);
printf("%dit"):
fun(i/2);}
else
printf("%dt",i);
return 0;
int main(0
{
printf(" %d ", fun(2.5);
getchar();
return 0;
Fig.01
A. 0,0,0,1,20 B. 0,0,0,0,20 JC. 0,0,0,0,10 D. 0,0,0,20
|CO-2, BTL-03, Marks-2.5]
Q2. What is the worst case time complexity of following implementation of given algorithm as given below?
int A(int n)
if (n<=1)
return 1;
else
A(n-1);
A(n/2);
if (n==1)
return 1;
else return (n+ module(n-1));
Qs. What is recurrence for worst case of Quick Sort and what is the time complexity in Worst case?
A. Recurrence is T(n) =T(n-2) + O(n) and time complexity is O(n^2)
B. Recurrence is T(n) = T(n-1) + O(n) and time complexity is O(n^2)
C. Recurrence is T(n) = 2T(n/2) + O(n) and time complexity is O(nlgn)
D. Recurrence is T(n) = T(n/10) + T(9n/10) + 0n) and time complexity is O(nlgn)
[CO-1, BTL-01, Marks-2.5]
Note: There
marks.
are only objective type questions and attempt all questions. Allquestions carry equalmarks i.e. 1.5
1.
Huffman tree is constructed for the following data: {A, B, C, D, E}with frequency {0.17, 0.J1, 0.24,
0.33 and 0.15} respectively. 100 00 01101 is decoded as
a. BACE b. CADE c. BAD d.CADD
|CO-2, BTL-03, Marks-1.5)
2 Which of the following statements are TRUE?
I. The problem of determining whether there exists a cycle in an undirected graph is in P.
2. The problem of determining whether there exists acycle in an undirectedgraph is in NP.
3. If a problem Ais NP-Complete, there exists a non-deterministic polynomial time algorithm to solve a problem.
(A)Only 1
(B) 1 and 2 only
(C) 2 and 3 only
(D) 1, 2 and 3 only
(E) None of these [CO-3, BTL-04, Marks-1.5|
3.
Consider a directed graph with vertex set {a, b, c, d, e, f}. Entry W, in the matrix Wgiven below is the weight
ofthe edge {i ,j}.
|-ln 88ols8oC D e f
1 4 -3
W=
3
C 4 3 0 6
6 7 3
-3 -1
f 2 1 3 -1
In this graph such that vertex c is a leaf node in the tree T and node b should be predecessor of c. What is the
total number of MST and their minimum weight? [CO-2, BTL-02, Marks-1.5
(a) 2 and 2
(b) 3 and 3
{c) 2 and 3
(d) Iand 2
(e) None of the above
4. Let suppose a thief stealing a store finds 5 items, the i" item is worth V, dollars and weight w, pounds where V, and
are integer as given below in table. He/she want to take as valuable a load as w,
possible but he/she can carry almost
W=10 pounds in his/her knapsack for some integer. What are the value of V[3][10] and V[S][4] to achieve the maximum
total value of packed items in the knapsack by dynamic technique.
a) 15 and 9
b) 9 and 10
c) 10 and 9
d) 8 and 9
e) None of the above
A
25 10
EC15 11
B
30\ 18 5
22
D
20
The total weight of the
minimum spanning tree is
A) 60. B) 34. C) 39. D) 49.
6. Dijkstra's Algorithm is the E) None of the above |CO-2, BTL-05, Marks-1.5]
a) Greedy algorithm prime example for
b) Branch and bound
c) Back tracking
d) Dynamic programming
7. Let G (V, E) an undirected graph with edge |CO-2 and 3, BTL-05, Marks-1.5]
weights. Prim's algorithm
structure and Fibonacci heap data structure for sparse graph with time can be implemented using the binary heapdata
complexity respectively:
a) o(vlgV+ElgV) and O(VlgV+E)
b) O(E+VlgV ) and O(VlgV+E)
c) o(VlgV+E) and O(V lgV)
d) o(E+V)lgV) and O(v')
8. What is the basic principle behind Bellmann Ford Algorithm? |CO-4 and 2, BTL-02, Marks-1.5]
a) Interpolation
b) Extrapolation
c) Regression
-d) Relaxation
|CO-3, BTL-01, Marks-1.5|
9. If a problem can be broken into subproblems which are reused several times. the problem possesses
property.
a) Overlapping subproblems
.b) Optimal substructure
c) Memoization
d) Greedy
10. Choose the correct answer for the |CO-3, BTL-01, Marks-1.5]
following statements:
I. The theory of NP-completeness provides a method of obtaining a polynomial time solution for NP
II. AllNP-complete problems are
NP-Hard. algorithms.
.a) Iis FALSE and Il is TRUE
b) Iis TRUE and II is FALSE
c) Both are TRUE
d) Both are FALSE
|CO-5, BTL-03, Marks-1.5]
B,Tech. (Sizth Semester)
graph sh (Computer
Subjeet- Design Wxamination-20124
ScieneeotVnonuring)
and Analysis
Note:-1There are only
suhjective
each question carries
Time allowed:
Maximum
type questions,
Three hours
Mark: 70 AlyorithmtC%2941PCH)
equal marks L.e, 7 Atempt uny two questions from euch unt and
marks, Asnume dutu if
Unit
required.
1. Proof that log ((2n)!) is
2. Solve the following theta (log(n!) and (2n)! is not thea (n) (Co-1, BTLA2, Marke)
T (n)T(n/2) +
recurrence relation by recurrence tree method CO-1, BT4, Marke
Otherwise T(n)
T(n/4)+T(n/%)+n, when n21
=1, when n<1
3. Write an algorithm of
merge sort by using the recursive function (CO-1, BTIA4, Marks
Unit-I1
4. Writc an algorithm of prim's for minimum
spanning tree. (CO-2, BTIA1, Marke7]
5. Let suppose a thíef stealing a store finds 5 items, the í itern is
worth V, dollars 2c weg
W; pounds where and W, are integer as given below in table. He/she want to take 2s vzbe
V,
a load as possible but he/she can carry almost W=10 pounds ín
hisher knapszck or e
integer. What ís the value of knapsack to achieve the rmaximurn total value of packei ites
the knapsack by greedy technique?
Item(i) Value (V) Weight (w)
15 2
2 10 3
3 9 3
20 4
5 18
[CO-2, BTL-03, Marks-7]
6, Elaborate the greedy technique and dynamic programming with at leastfour differemses
[CO-2, BTI-02, Marks-7]
Unit-11!