0% found this document useful (0 votes)
14 views

DAA 6TH.pyq

The document outlines the examination structure for the B.Tech. (Sixth Semester) in Computer Science & Engineering, focusing on the subject of Design and Analysis of Algorithms. It includes objective type questions covering various topics such as recursive functions, time complexity, NP problems, Huffman trees, and minimum spanning trees, along with their respective marks. Additionally, it contains subjective questions requiring algorithm writing and proof techniques.

Uploaded by

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

DAA 6TH.pyq

The document outlines the examination structure for the B.Tech. (Sixth Semester) in Computer Science & Engineering, focusing on the subject of Design and Analysis of Algorithms. It includes objective type questions covering various topics such as recursive functions, time complexity, NP problems, Huffman trees, and minimum spanning trees, along with their respective marks. Additionally, it contains subjective questions requiring algorithm writing and proof techniques.

Uploaded by

Varun Sahu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

B.Tech. (Sixth Semester.

New AICTE) CT-01, Examination, 2023-2024


(Computer Science & Engineering Branch)
Subject-Design and Analysis of Algorithm
Time Allowed:- One hour
Maximum Marks:- 15

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);

for (i=1; i<= n; itt){


statement 1;}

"A. Ofn'+2ey B.O(n'lgn+n) C. Ogn+n) D. O(n'2") E. None of them


|CO-2, BTL-04, Marks-2.5)
Q3. Let's consider a problem X is NP type and problem Z is unknown. Another problem Y is NP-hard type.
Problem is polynomial time reduction to Z and problem Y is polynomial time reducible to Z. In this
scenario now what is class of problems X,Yand Zrespectively'?
(a) NP, NPH and NPC (b) NP, NPH and NP (c) NP, NPH and NPH (d) NP, NPH and undecidable
(e)None of the above
[CO-5, BTL-04, Marks-1.5]
Q4. What is the worst case time complexity of following implementation of given algorithm as given below?
int module (int n)

if (n==1)
return 1;
else return (n+ module(n-1));

-A. O(n) B.0( Ign) C. O(2) D.O(n) E. None of them


(CO-1, BTL-01, Marks-2.5|

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]

Q6. Consider the following functions:


f(n) = 2
gn) = n!
h(n) = ngn
Which of the following statements about the asymptotic behaviour of f(n), g(n), and h(n) is true?
.f(n)= 0g(n)); g(n) = 0(h(n)
B. f(n) = 2(g(n)); g(n) = O(h(n))
C. g'n)= 0(f(n)); h(n) = 0(f(n))
D. h(n) = O(f(n); g(n) =2(f(n) (CO-1, BTL-02, Marks-2.5]
B.Tech. (Sixth Semester, New AICTE)CT-02, Examination, 26-02-2024
(Computer Science &Engineering Branch)
Subject-Design and Analysis of Algorithm
Time Allowed:- One hour
Maximum Marks;- 15

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.

Item(i) Value (V) Weight (w)


15
2 10
3
4 20 4
5 6

a) 15 and 9
b) 9 and 10
c) 10 and 9
d) 8 and 9
e) None of the above

[CO-3, BTL-05, Marks-1.5]


5. The
below. question(s) that follow refer to the problem of finding the minimum spanning tree for the weighted graph
shown

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!

7 Write an algorithm of topological soring with example |C0-3, BTL-01. Mark-7


8. Write an algorithm for 0/1 Knapsack problem using dynamic programming techrigue
(CO-3, BTL-02, Marks-7)
9 Write an algorithm of Floyd-Warshall for all pair shortest path with recursive fomlz
|CO-3, BTL-01, Marks-7|

You might also like