0% found this document useful (0 votes)
32 views9 pages

Daa Question Papers

The document discusses algorithms and data structures. It contains questions related to solving recurrences using different methods, master's theorem, time complexity of mergesort and quicksort, matrix chain multiplication using dynamic programming, and solving 0/1 knapsack problem. It asks students to solve these problems and concepts.

Uploaded by

Narasimha
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)
32 views9 pages

Daa Question Papers

The document discusses algorithms and data structures. It contains questions related to solving recurrences using different methods, master's theorem, time complexity of mergesort and quicksort, matrix chain multiplication using dynamic programming, and solving 0/1 knapsack problem. It asks students to solve these problems and concepts.

Uploaded by

Narasimha
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/ 9

RajivGandhi University of Knowledge Technologies

RK Valley

AcademicYear 2022 – 23: Semester I

End Semester Test

Computer Science & Engincering


CS2101- Design and Analysis of Algorithms

(R19Batch & Regular Mode of Examinations)


Year: ENGG-2 Date of Examination: 13-Feb-2023

Time: 180 Minutes Max Marks: 60

SECTION-B

Answer thefollowing question. Each question carries SEVEN mark. (6 X7 =42 M)

B.Solve T(n)= 2 T(n/2)+n using Iteration metho.


OR
2. Design an algorithm to solve Matrix chain multiplication problem by using Dynamic
programming with analysis.

Findthe feasible solution for following Job sequence with deadline


Job Number
Deadine
Profit
J1

20
J2

40
J3
4
6

OR
15
JS

10
J6

8
S, 23!
4. Solve the Fibonacci Series problem using Dynamic programming using Top-down
approach and Bottom-up approach

5. Describes how toevaluate and compare different algorithms using worst-case, average
case and best-case analysis,
OR
Find the minimum spanning tree in a graph using Prim's algorithm(Take an example on your own)?
Ind the shortest path for single source to all nodes( Source = A)

3
2 6

OR
oC8. Explain quick sort worst case with example. And compute time complexity for worst
case.
C9Define heap. And sort following example in descending order using heapsort.
Ex: 4,5,2,7,8,1,9,6

OR
A0.Find the shortest path for allpairs for following graph

11 13

5
3

11.gind all possible solutions for 4-queen problem using Backtracking


OR
12.Compute time complexities for Mergesort in all cases.
Rajiv Gandhi University of Knowledge Technologies
RK Valley
Acndemic Year 2022 - 23: Semester I

End Semester Test

Computer Sciencc & Engineering


CS2101- Design and Analysis of Algorithms

(R19 Batch & Regular Mode of Examinations)

Year: ENGG-2 Date of Examination: 13-Feb-2023

Time: 180 Minutes Max Marks: 60

SECTION-A

one mark. (18 X 1 18 M)


Answer the following question. Each question carries

1. Bellman-ford's algorithm used tc A1Ye following problem?


A. All pair shortest path
B. Min-cut
erD. Minimum
Single source shortest patit
spanning tree
uses which aigorithm design technique?
2. Bellman Fordalgorithm
A. Dynamic Programming
Greedy Algorithms
B.C. Linear Programming
D.
Branch and Bound
are 4 items with
3. You are given knapsack that can carry a maximum weight of 60. There
a
maximum value of the
weights (20, 30, 40, 70} and values {70, 80, 90, 200}.What the
is
knapsack?
items you can carry using the
A) 160
Joy 200
c) 170
d) 90
a guess
4
For solving recurrences, which of the following method is used to generate good
of the solution?
a) Iteration method
J Substitution mcthod
c) Recursion trcc method
d) Mastcr method

5.Approach used by Matrix chain multiplication algorihm


Dynamic Programming
b) Grccdy
c) Brute Forcc
d) Branch and Bound

6. Which
a
of the following is properties of a dynamic programming problem?
Optimal substructure
b) Overlapping subproblems
c) Greedy approach
) Both optimal substructure and overlapping subproblems
7. Which of the following problens is NOT solved using dynamic programming?
a) 0/1 knapsack problem
b) Matrix chain multiplication problem
c) TSP
fractional knapsack problem

8. Dijkstra's Algorithm cannot be applied on


a) Directed and weighted graphs
6) Graphs having negative weight function
c) Unweighted graphs
váj Undirected and unweighted grapits
9. The best case time complexity of binary searcii
O(1)

b. O(logn)

c. O(nlogn)

d. None
10. Fill the blanks in the following recurrence rclation of Matrix Chain Multiplication:

0, ifi = j
min(i,j) = minfm[.., )+ m{#;.) + P-iRP}. ifi <i
i<=k<

.
a. i,k and kj

i,k and k+1j


c.
i,k-land j,k
d. ik andk-1,j

l. We are given a graph with 3 vertices, We nced to color the graph using three colors.
What is number of intemal nodes in the state space trec that represents the solution space of
the problcm?

b. 10

C. 13

12. Which of the following sorting algorithms provide the best time complexity in the
worst-case scenario?

a. Merge sort

b. Quicksort

ensetionsort
d. Selection sort

13. Identify the best case time cornpiexity of selection sort?

.
Log n

n^2

C, n

d. nlogn

14. Among the following options which is the best sorting algorithm when the list is
already sorted?

yoa. Merge sort

je b. Quicksort
ye. Insertion sort
d. Selection sort
15. O(n) is
Lincar
b)Quadrate
c) Cubic
d) Exponential
16. A hcap is a trec
) Binary
b)Completely Binary
e) Almost Completely Binary
d) None of the above

17. Each Algorithm begins with a


a) Condition.
6)Parameter.
c) Retum Statement.
eHeader.
18. Which of the following is not an exchange sort?
a) Butbble Sort
b) Quick Sort
c) Partition-exchange Sort
einsertion Sort
RGUKT RK Valley (Idupulapaya)
RajivGandhi University of KnowledgeTechnologies- Andhra Pradesh
AcademicYear 2022-23: SemesterI
Mid cxamination -II

CSE
DAA
RÌ9 Batch& Regular mode
Date of Examination27-12-2022
Year: ENGG-2
Max Marks:15
Time: 60 Minutcs

Answer the foilowing questions


recursive tree method and Iteration
1. Solve following recurrerce relation by using
method.

T(n)= 2T(n/2) + 3
(OR)
recurrence relations by using Master's theorem
2. Solve following
n
(iv) T(n)= 6T(n/4) +
2T(n/2) + nlogn
(v) T(n)=
+ n.
(vi) T(n)=T(n/2)

Mergesort with example


3. Compute best case time-complexity for
(OR)
worst case timne-complexity for Quicksort with example
4. Compute

4x10, 10x3, 3x12,


are given the sequence (4, 10,3,12) The matrices have size
5. We programming.
Compute M[1,3] using Dynamic
(OR) capacity n=5,
to 0/1 knapsack problem with
6. Findan optimal solution the weights(wl,w2,w3,w4)= (2,3,2,5).
and
values (il,i2,i3,i4)=(10,5,15,10)
h

RGUKT RK Valley
(ldupulapaya)
Rajiv Gandhi University of Knowledge Technologies- Andhra Pradesh
Academic Ycar 2022-23: Semester I
Mid examination -II

CSE
DAA

Year: ENGG-2
R19 Batch& Regular mode
Date of Examination27-12-2022
ol^)
Time: 60 Minutes Max Marks:15

Answer the following questions

1. Solve following recurrence relation by using recursive tree method and Iteration
method.

T(n)=2T(n/2) + n
(OR)

Solve following recurrence reiatiois by using Master's theorem


(iv) T(n)= 6T(n/4) + n
(v) T(n)= 2 T(n/2} + nlogs
(vi) T(n)=T(n/2) +
n

3.Compute best case time-complexity for Mergesort with example


(OR)
4. Compute worst case time-complexity for Quicksort with example

5. We are gíven the sequence (4,10,3,12}. The matrices have size 4x10, 10x3, 3x12.
Compute M[I,3] using Dynamic programming.
(OR)
6. Find an optimal solution to the 0/l knapsack problem with capacity m=5,
values (il,i2,i3,i4)=(10,5,15,10) and weights(wl,w2,w3,w4)= (2,3,2,5).

ma
RGUKT RK Valley (Idupulapaya)
Rajiv Gandhi University of Knowledge Technologies- Andhra Pradesh
Acndemic Year 2022-23: Semester
Mid examination -1
CSE
DAA
R19 Batch& Regular mode
Year:ENGG-2 Date of Examination:17/11/22
Time:60 Minutes

.
Max Marks:15

Answerthe following questions


Write any seven algorithm specifications.

(OR)
2. Define an algorithm. And write an algorithm for some of all the elements in an
array.
3. Explain upper bound and loose upper boundnotations in detail.
(OR)
4. Compute time complexity for following piece of code.
(i)
while (1 <D
1f (condition)
some 0(2), expressions

else

some o(1) expressions

some o(1) expressions

(ii)
for (int i= 1; i (e3*n; i= i+1)

some 0(1) expressions

5. Take an example and compute time complexities for insertion sort in all three
cases.
(OR)
6. Sort the following elements in descending order by using heap sort.
5,7,1,3,6,2,4,9

You might also like