Computer Course Daa
Computer Course Daa
|''|'||||''|'''|||'|
Code No: R2032423 R20 SET -1
UNIT-V
9. a) State and prove Cook’s theorem [7M]
b) Explain the P, NP, NP-Hard and NP- complete classes with suitable examples [7M]
(OR)
10. a) Write about non deterministic algorithms and choice, failure and success [7M]
functions with search example
b) Using an example prove that, satisfiability of boolean formula in 3-Conjunctive [7M]
Normal form is NP-Complete.
2 of 2
|''|'||||''|'''|||'|
Code No: R2032423
R203105O
R2031011
R2031351
R203135A
R203147A
R203147C
P2031051 R20 SET
SET
RA--22
UNIT-I
1. a) Compare Big-oh notation, Omega Ω and Little-oh notation. Illustrate with an [7M]
example.
b) Define time complexity? Explain time complexity of insertion sort in different [7M]
cases.
(OR)
2. a) Write Randomized algorithm for Quick sort. Analyze its performance with [7M]
quick sort algorithm without randomization.
b) Write an algorithm for Binary search and analyze the algorithm for its time [7M]
complexity
UNIT-II
3. a) Explain Defective chess board Problem with example [7M]
b) Write Prim’s algorithm to generate minimum cost spanning tree for the given [7M]
graph
(OR)
4. a) Design the algorithm to find the minimum and maximum element of given [7M]
array and derive its time complexity.
b) Explain the Knapsack problem. Find an optimal solution to the Knapsack [7M]
instance n=7, m=15,
(p1, p2, p3, …p7)=(10,5,15,7,6,18,3) and (w1, w2, w3, …w7)=(2, 3, 5,7, 1, 4,
1).
UNIT-III
5. a) Draw an Optimal Binary Search Tree for n=4 identifiers (a1,a2,a3,a4) = ( do, [7M]
if, read, while) P(1:4)=(3,3,1,1) and Q(0:4)=(2,3,1,1,1).
b) Write and explain an algorithm to compute the all pairs shortest path using [7M]
dynamic programming and prove that it is optimal
(OR)
1 of 2
|''|'||||''|'''|||'|
Code No: R2032423 R20 SET -2
6. a) Write dynamic programming solution for the traveling sales person problem [7M]
for the network with the cost adjacency matrix. Assume node 1 as the home
city.
0 10 15 30
4 0 9 11
5 13 0 10
7 7 8 0
b) Compute All pairs-shortest
shortest path for following graph [7M]
UNIT-IV
7. a) Find all m-colors
colors of a graph with undirected connections v1
v1->2, v1-->v3, v1- [7M]
>v4, v2->v3, v2->v4,
>v4, v2
v2->v5, v3->v4, v4->v5
>v5 using backtracking technique.
b) What is sum-of-subsets
subsets problem? Write a recursive backtracking algorithm for [7M]
sum of subsets problem.
(OR)
8. a) Explain the Graph – coloring problem. And draw the state space tree for m= [7M]
3colors n=4 vertices graph. Discuss the time and space complexity
b) Briefly explain n-queen
queen problem using backtracking [7M]
UNIT-V
9. a) Explain the strategy to prove that a problem is NP hard
hard. [7M]
b) Is Travelling salesman problem NPNP-hard or NP-Complete?
Complete? Justify your answer. [7M]
(OR)
10. a) Show that the HAMILTONIAN_CYCLE problem on directed graphs is NP NP- [7M]
complete
b) Relate deterministic problems, NP problems, NP hard and NP complete [7M]
problems. Discuss the examples.
2 of 2
|''|'||||''|'''|||'|
Code No: R2032423 R20 SET -3
1 of 2
|''|'||||''|'''|||'|
Code No: R2032423 SET -3
R20
UNIT-III
5. a) Solve the following instance of 0/1 KNAPSACK problem using Dynamic [7M]
programming n = 3, (W1, W2, W3) = (2, 3, 4), (P1, P2,P3) = (1, 2, 5), and m =
6.
b) Write dynamic programming solution for the traveling sales person problem [7M]
for the network with the cost adjacency matrix. Assume node 1 as the home
city.
0 10 15 30
4 0 9 11
5 13 0 10
7 7 8 0
(OR)
6. a) Illustrate the working principle of dynamic programming with all pairs shortest [7M]
path problem.
b) Draw an Optimal Binary Search Tree for n=4 identifiers (a1,a2,a3,a4) = ( do, [7M]
if, read, while) P(1:4)=(3,3,1,1) and Q(0:4)=(2,3,1,1,1)
UNIT-IV
7. a) Write backtracking algorithm of Graph coloring problem and derive its time [7M]
complexity
b) Write backtracking algorithm of N-Queens problem and derive [7M]
its time complexity
(OR)
8. a) find the solutions for the subset sum for N=7, m=35, w={5,7,10,12,15,18,20} [7M]
using back tracking approach.
b) Explain how the Hamiltonian circuit problem is solved by using the [7M]
backtracking concept.
UNIT-V
9. a) State and prove Cook’s theorem [7M]
b) Explain the classes of NP-Hard and NP-Complete. [7M]
(OR)
10. a) Write a non-deterministic algorithm of sorting a list of elements in an array. [7M]
b) Explain Nondeterministic knapsack algorithm. [7M]
2 of 2
|''|'||||''|'''|||'|
Code No: R2032423
R2031011
R2031351
R203135A
R203147A
R203147C
R203105O
P2031051 R20 SET
SET
RA--42
(OR)
4. a) Explain the concept of minimum cost spanning tree? What are the different [7M]
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
step.
1 of 2
|''|'||||''|'''|||'|
Code No: R2032423 R20 SET -4
b) Write greedy algorithm for knapsack problem. Find the solution for the [7M]
following Knapsack problem using greedy method
(p1,p2,p3,p4)=(2,5,8,1), (w1,w2,w3,w4)=(10,15,6,9) and m=30
UNIT-III
5. a) Solve the following 0/1 Knapsack Problem using dynamic programming n=4, [7M]
m=30, (w1,w2,w3,w4) = (10,15,6,9) and (p1, p2, p3, p4) = (2,5,8,1)
b) Use the function OBST to compute w(i,j), r(i,j), and c(i,j), 0 ≤ i < j ≤ 4, for the [7M]
identifier set (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 the r(i,j)’s construct the optimal binary search tree
(OR)
6. a) Address the problem of multistage graph using dynamic programming. [7M]
UNIT-IV
7. a) Explain the key concepts of backtracking and state space tree with about 8- [7M]
queens problem.
b) Explain the Graph–coloring problem. Draw the state space tree . [7M]
(OR)
8. a) Find a solution to sum of subsets problem using backtracking strategy. Draw [7M]
the solution space using necessary bounding function m=12 with items
(2,3,1,4,5,6,7) n=7
b) Explain the major drawbacks of backtracking method with example. [7M]
UNIT-V
9. a) Differentiate between deterministic and non deterministic algorithm.. [7M]
b) Discuss in detail about the classes of NP-hard and NP-complete. [7M]
(OR)
10. a) Explain circuit satisfiability problem with a circuit diagram. Show that circuit [7M]
satisfiability problem is NP- hard.
b) Compare NP Hard and NP Complete. [7M]
2 of 2
|''|'||||''|'''|||'|