21.previous Question Papers
21.previous Question Papers
21.previous Question Papers
6. Consider four elements a1 < a2 < a3 < a4 with q(1, 2, 3, 4) = (1/8, 3/16, 1/16, 1/16) and
-2
(p1, p2, p3, p4) = (1/4, 1/8, 1/16, 1/16). Construct the table of values of W (i, j), R(i, j)
and C(i, j) computed by the algorithm to compute the roots of optimal sub-tree. [15]
02
7.a) Describe Greedy method control abstraction for the subset paradigm.
b) Write an algorithm of Greedy knapsack. [8+7]
---oo0oo---
R18
U
Code No: 156AN
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
SE
B. Tech III Year II Semester Examinations, August/September - 2021
DESIGN AND ANALYSIS OF ALGORITHMS
(Computer Science and Engineering)
Time: 3 Hours Max. Marks: 75
Answer any five questions
D
All questions carry equal marks
---
PA
1.a) Write and explain randomized quick sort algorithm.
b) Discuss about Big oh O, Omega Ω and Theta θ notations with examples. [8+7]
3.a) Show that depth first search can be used to find the connected components of an
R
undirected graph.
b) Write an algorithm of n-queen’s problem and explain. [8+7]
SA
4. Suppose we start with n sets, each containing a distinct element.
a) Show that if u unions are performed, then no set contains more than u+1 elements.
b) Show that at most n – 1 unions can be performed before the number of sets
U
becomes 1.
c) Show that if fewer than (n/2) unions are performed, then at least one set with a single
element in it remains.
G
[5+5+5]
5.a) Solve the following 0/1 Knapsack Problem using dynamic programming
/S
n=4, m=30, (w1,w2,w3,w4) = (10,15,6,9) and (p1, p2, p3, p4) = (2,5,8,1).
b) Explain the concept of the traveling salesperson problem. [7+8]
EP
6. Use the function OBST to compute w(i,j), r(i,j), and c(i,j), 0 ≤ i < j ≤ 4, for the
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. [15]
-
7.a) Explain the general method of Greedy method.
20
b) Write and explain the Kruskal’s algorithm with an illustrative example. [7+8]
8.a) Explain with respect to branch and bound 0/1 knapsack problem.
21
b) Discuss in detail about the classes of NP-hard and NP-complete. [7+8]
---ooOoo---
Code No: 156AN R18
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
B. Tech III Year II Semester Examinations, February - 2023
DESIGN AND ANALYSIS OF ALGORITHMS
JN
(Common to CSE, ITE)
Time: 3 Hours Max. Marks: 75
PART – B
pe
(50 Marks)
6. Use the function OBST to compute w(i, j), r(i, j), and c(i, j), 0 ≤ i < j ≤ 4, for the
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. [10]
OR
7. Discuss about all pairs shortest problem using dynamic programming. [10]
8. Compute a minimum cost spanning tree for the graph shown below using
a) Prim’s algorithm and
b) Kruskal’s algorithm. [5+5]
JN
TU
H
OR
U
9. Explain about single source shortest path problem in Greedy method. [10]
se
10. Describe LC branch and bound solution of 0/1 Knapsack problem in detail. [10]
OR
11. Explain the following:
d
a) Nondeterministic knapsack algorithm
b) FIFO branch and bound. [5+5]
pa
---ooOoo---
pe
rs
20
23
R18
us
Code No: 156AN
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
B. Tech III Year II Semester Examinations, February/March - 2022
ed
DESIGN AND ANALYSIS OF ALGORITHMS
(Computer Science and Engineering)
Time: 3 Hours Max. Marks: 75
Answer any five questions
All questions carry equal marks
pa
---
1.a) Discuss in detail various notations used for expressing the time complexity of
pe
algorithms, with examples.
b) What is Performance Analysis? Explain Space Complexity and Time Complexity with
examples. [7+8]
rf
2.a) Explain the process of merge sort by a list of any 11 integers (distributed randomly).
Write the algorithm and analyze its time complexity.
eb
b) Write an algorithm to find matrix multiplication using Strassen’s. [8+7]
3.a) Describe the Backtracking technique to the m-coloring graph. Explain with an example.
b) Write an algorithm of weighted union and also compute the time complexity of the
/m
same. [8+7]
4.a) Draw the state space tree for ‘m’ coloring when n=3 and m=3.
ar
b) Write an algorithm for the 8-queens problem using backtracking. [8+7]
5.a) Solve the solution for 0/1 knapsack problem using dynamic programming:
-2
(p1,p2,p3, p4) = (11, 21, 31, 33), (w1, w2, w3, w4) = (2, 11, 22, 15), M=40, n=4.
b) State the principle of optimality in dynamic programming. How to apply this to the
0
shortest path problem? [8+7]
22
6.a) Explain about OBST.
b) Write an algorithm of all pairs shortest path problem. [8+7]
7. Explain the problem of job sequencing with deadlines by taking an example. Write the
jn
algorithm to solve the problem using the Greedy Method. Show how the algorithm
solves the following job sequencing with deadlines problem.
n = 4, (p1, p2, p3, p4) = (100, 10, 15, 27) and (d1, d2, d3, d4) = (2, 1, 2, 1) [15]
tu
8.a) Explain Cook’s theorem with an example.
h
b) Discuss the FIFO branch and bound. [8+7]
---oo0oo---
Code No: 114CS R13
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
B.Tech II Year II Semester Examinations, May - 2015
DESIGN AND ANALYSIS OF ALGORITHMS
(Computer Science and Engineering)
PART- A
(25 Marks)
1.a) Explain amortized complexity [2M]
b) Show that if f(n) = amnm + …..+ a1n + a0 then f(n) = O( nm ). [3M]
c) What is AND/OR graph? [2M]
d) Take a graph of 5 nodes and traverse it in preorder, inorder, and postorder.
[3M]
e) What is traveling sales person problem? [2M]
f) Can we solve 0/1 knapsack problem with greedy method? Comment on
your answer. [3M]
g) What is Hamiltonian cycle? [2M]
h) What do you mean by bounding? [3M]
i) What is meant by non-deterministic algorithm? [2M]
j) What is NP-hard problem? [3M]
PART-B
(50 Marks)
2.a) Write and explain the control abstraction for Divide and conquer.
b) Explain the theta notation used in algorithm analysis. [6+4]
OR
3.a) Sort the records with the following index values in the ascending order
using quick sort algorithm. 2, 3, 8, 5, 4, 7, 6, 9, 1
b) What is probabilistic analysis? Give example. [6+4]
4.a) What is weighting rule for Union(i,j)? How it improves the performance
of union operation?
b) What is biconnected graph? [6+4]
OR
5.a) Explain the Find algorithm with collapsing rule
b) What is spanning tree? [6+4]
6.a) What do you mean by forward and backward approach of problem solving in
Dynamic Programming?
b) What is greedy strategy? [6+4]
www.ManaResults.co.in
OR
7.a) Discuss about all pairs shortest path problem with suitable example.
b) Discuss briefly about the minimum cost spanning tree. [6+4]
8. Draw the portion of the state space tree generated by LCBB for the
knapsack instances: n=5, (P1, P2,… , P5) = (12,10,5,9,3), (w1, w2,
...,w5)=(3, 5, 2, 5, 3) and M =12. [10]
OR
9. What is sum-of-subsets problem? Write a recursive backtracking
algorithm for sum of subsets problem. [10]
--ooOoo--
www.ManaResults.co.in
www.ManaResults.co.in
www.ManaResults.co.in
Code No: 114CS R13
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
B.Tech II Year II Semester Examinations, May - 2016
DESIGN AND ANALYSIS OF ALGORITHMS
(Computer Science and Engineering)
Time: 3 Hours Max. Marks: 75
8. Draw the portion of the state space tree generated by LCBB for the following
instances:
n=5, m=12, (P1 P5) = (10, 15, 6, 8, 4) (w1 w5) = (4, 6, 3, 4, 2) [10]
……….. …………
OR
9.a) Describe Backtracking technique to m-coloring graph.
b) Briefly explain n-queen problem using backtracking. [5+5]
www.ManaResults.co.in
10.a) Explain the classes of NP-Hard and NP-Complete.
b) Explain the satisfiability problem. [5+5]
OR
11.a) Explain the strategy to prove that a problem is NP hard.
b) Explain the non-deterministic sorting problem. [5+5]
---ooOoo---
www.ManaResults.co.in
Code No: 114CS R13
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
B.Tech II Year II Semester Examinations, October/ November- 2016
DESIGN AND ANALYSIS OF ALGORITHMS
(Computer Science and Engineering)
PART- A
(25 Marks)
1.a) Define the time complexity. [2]
b) List out the reasons for the difficulties that one faces while determining the lower
bound. [3]
c) Write an algorithm of simple union. [2]
d) What are the applications of game tree? [3]
e) Write an algorithm of greedy knapsack. [2]
f) State the principle of optimality. [3]
g) Define State space tree. [2]
h) Write the control abstraction algorithm for LC search. [3]
i) What is the relation between NP-hard and NP-complete? [2]
j) Distinguish between deterministic and non deterministic algorithm. [3]
PART-B
(50 Marks)
2.a) Trace the quick sort algorithm to sort the list C, O, L, L, E, G, E in alphabetical
order.
b) Solve the following recurrence:
T(n)=4T(n/2)+n, Where n 1 and is a power of 2. [5+5]
OR
3.a) Write the non-recursive algorithm for finding the Fibonacci sequence and define
its time complexity.
b) Consider the following recurrence equation: [5+5]
1 if n 1
T(n): T(n)=
T ( n 1) n
n
o th e r w is e
www.ManaResults.co.in
6. Write an algorithm of Prim’s minimum cost spanning tree. [10]
OR
1 1
7. Consider 4 elements al < a2 < a3 < a4 with q(0) = , q(1) = , q(2) = q(3) =
8 16
1 1 1 1
q(4) = : p(1) = , p(2) = , p(3) = p(4) = . Construct the table of values
16 4 8 16
of W (i, j), R (i. j) and C(i, j) computed by the algorithm to compute the roots of
optimal sub trees. [10]
8. Draw the portion of the state space tree generated by LC branch and bound for an
instance n=4, (P1, P2, P3, P4)= (10,10,12,18), (w1, w2, w3, w4)=(2, 4, 6, 9), and
m=15. [10]
OR
9.a) Explain the 4-queen problem using backtracking.
b) Draw the state space tree for m-coloring graph. [5+5]
---ooOoo---
www.ManaResults.co.in
www.ManaResults.co.in
www.ManaResults.co.in
www.FirstRanker.com www.FirstRanker.com
PART - A
(25 Marks)
1.a) In what way a time complexity differs from space complexity. [2]
b) Give the general plan of divide and conquer algorithms. . [3]
c) Write an algorithm for collapsing find. [2]
d) Define Backtracking? List the applications of Backtracking [3]
e) What is the importance of knapsack algorithm in our daily life? [2]
f) Write Control Abstraction of Greedy method. [3]
g) What you mean by dynamic programming. [2]
om
j) Write the Control Abstraction of Least – Cost Branch and Bound. [3]
ke
PART - B
an
(50 Marks)
tR
irs
2.a) What are the different mathematical notations used for algorithm analysis.
b) Write Divide – And – Conquer recursive Quick sort algorithm and analyze the
.F
OR
w
w
www.FirstRanker.com
www.FirstRanker.com www.FirstRanker.com
8. Draw an Optimal Binary Search Tree for n=4 identifiers (a1,a2,a3,a4) = ( do, if, read,
while) P(1:4)=(3,3,1,1) and Q(0:4)=(2,3,1,1,1). [10]
OR
9. Explain how Matrix – chain Multiplication problem can be solved using dynamic
programming with suitable example. [10]
10. Solve the Travelling Salesman problem using branch and bound algorithms. [10]
OR
11. Explain the FIFO BB 0/1 Knapsack problem procedure with the knapsack instance for
n=4, m=15,(p1,p2,p3,p4)=(10,10,12,18), (w1,w2,w3,w4) =(2, 4, 6, 9). Draw the portion
of the state space tree and find optimal solution. [10]
---ooOoo---
om
r.c
ke
an
tR
irs
.F
w
w
w
www.FirstRanker.com
R18
us
Code No: 156AN
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
B. Tech III Year II Semester Examinations, February/March - 2022
ed
DESIGN AND ANALYSIS OF ALGORITHMS
(Computer Science and Engineering)
Time: 3 Hours Max. Marks: 75
Answer any five questions
All questions carry equal marks
pa
---
1.a) Discuss in detail various notations used for expressing the time complexity of
pe
algorithms, with examples.
b) What is Performance Analysis? Explain Space Complexity and Time Complexity with
examples. [7+8]
rf
2.a) Explain the process of merge sort by a list of any 11 integers (distributed randomly).
Write the algorithm and analyze its time complexity.
eb
b) Write an algorithm to find matrix multiplication using Strassen’s. [8+7]
3.a) Describe the Backtracking technique to the m-coloring graph. Explain with an example.
b) Write an algorithm of weighted union and also compute the time complexity of the
/m
same. [8+7]
4.a) Draw the state space tree for ‘m’ coloring when n=3 and m=3.
ar
b) Write an algorithm for the 8-queens problem using backtracking. [8+7]
5.a) Solve the solution for 0/1 knapsack problem using dynamic programming:
-2
(p1,p2,p3, p4) = (11, 21, 31, 33), (w1, w2, w3, w4) = (2, 11, 22, 15), M=40, n=4.
b) State the principle of optimality in dynamic programming. How to apply this to the
0
shortest path problem? [8+7]
22
6.a) Explain about OBST.
b) Write an algorithm of all pairs shortest path problem. [8+7]
7. Explain the problem of job sequencing with deadlines by taking an example. Write the
jn
algorithm to solve the problem using the Greedy Method. Show how the algorithm
solves the following job sequencing with deadlines problem.
n = 4, (p1, p2, p3, p4) = (100, 10, 15, 27) and (d1, d2, d3, d4) = (2, 1, 2, 1) [15]
tu
8.a) Explain Cook’s theorem with an example.
h
b) Discuss the FIFO branch and bound. [8+7]
---oo0oo---