Daa R16 Questions-2023
Daa R16 Questions-2023
PART – B
pe
(50 Marks)
2.a) Sort the following data using Quick Sort and illustrate each step with appropriate figure
rs
for each iteration. [ 20, 12, 35, 15, 11, 19, 35 ]
b) Write the Recurrence relation and derive the best case complexity for the Quick Sort.
[5+5]
20
OR
3.a) Describe asymptotic notations Big Oh (O), Omega (Ω) and Theta (Ɵ) notations and show
their behavior using graphical representation.
b) Give the asymptotic bounds for the equation f(n)=2n3-6n+30 and represent in terms of Ɵ
23
notation. [5+5]
4. Generate the state space tree and find the solutions for the subset sum for N=7, m=35,
w={5,7,10,12,15,18,20} using back tracking approach. [10]
OR
5. Write an algorithm for Graph Coloring problem and explain with an example. [10]
6. Explain the concept of minimum cost spanning tree? What are the different algorithms
exist for obtaining minimum cost spanning tree. Compute the minimum cost spanning
tree using Prim’s algorithm for the given graph. Draw the spanning tree generated at each
step. [10]
JN
TU
H
OR
7. Write greedy algorithm for knapsack problem. Find the solution for the following
U
Knapsack problem using greedy method.
(p1,p2,p3,p4)=(2,5,8,1), (w1,w2,w3,w4)=(10,15,6,9) and m=30. [10]
se
8.a) Write an algorithm for all pairs shortest path. Define its complexity.
b) Compute the shortest distance between each pair of nodes for the following graph using
d
all pair shortest path algorithm. [5+5]
pa
pe
OR
Use the function OBST to compute w(i, j), r(i, j) and c(i, j), 0≤i≤j≤4 for the identifier set
rs
9.
(a1,a2,a3,a4)=(do, if, int, while) with p(1:4)=(3,3,1,1) and q(0:4)=(2,3,1,1,1) using
r(i,j)’s construct optimal binary search tree. [10]
20
10. Generate the state space tree using FIFO Branch and Bound and find the shortest path
followed by the travelling salesperson instance defined by the cost matrix given below.
[10]
23
∞ 7 3 12 8
3 ∞ 6 14 9
5 8 ∞ 6 18
9 3 5 ∞ 11
[ 18 14 9 8 ∞ ]
OR
11. Explain circuit satisfiability problem with a circuit diagram. Show that circuit
satisfiability problem is NP- hard. [10]
---ooOoo---