Cse 5
Cse 5
com
om
7
t n n , if n = 0 or n = 0 or n = 2
e.c
5 t n 1 8 t n 2 4 t n 3 , otherwise.
lin
on
nu
b) Prove that 4
m
.rt
n
log (i) 0 (n log n ) w
w
i 1
w
c) Show that 3
log ! 0 (n log n)
OR
om
e.c
2. a) Use Master Method to give tight asymptotic bound for the following recurrence. 8
lin
2 n 3
T ( n ) 4T n
on
i)
nu
T(n ) T 9n n
m
.rt
ii) 10
w
w
w
3. a) What is amortized complexity? Find potential candidates for four bit binary incrementor 6
ranging from 0 to 8.
b) Give Stepwise operation of Heap sort on following input array & also explain the 7
complexity of heap sort.
A 4, 8, 20, 17, 7, 25, 2, 13, 5
OR
4. a) What is sorting network? Design a 8 bit bitonic sorting Network and explain its operation 7
for 1, 3, 5, 9, 8, 7, 4, 2
KNT/KW/16/7353 1 P.T.O
www.rtmnuonline.com
www.rtmnuonline.com
5. a) Find out average number of comparisons required for successful and unsuccessful binary 6
search on following array.
-12, 23, 31, 45, 56, 78, 90, 103, 113, 126, 157
b) Write an algorithm for evaluation of partial knapsack. Find the optimal solution for the 7
following partial knapsack instance.
n 4, M 11
w (1, 2, 5, 8, 7)
p (1, 6,18, 25, 30)
OR
6. What is Minimum Cost Spanning tree? Write an algorithm for Prim's method for finding 13
the minimum cost spanning tree. Also discuss its complexity solve the following using
Prim's Algorithm.
5
om
1 8
e.c
9 27
lin
4
2
on
6
14
nu
16
m
25 7
.rt
22 1
w
w
5 3
18
w
24 12
4
7. a) Write algorithm to generate LCS - Matrix and Print - LCS Implement the algorithm on 8
following strings to construct LCS matrix.
om
String A = 101101101
e.c
String B = 0101101
lin
on
b) What is travelling salesman problem? Implement TSP for the following matrix 6
nu
0 10 15 20
w
w
5 0 9 10
6 13 0 12
8 8 9 0
OR
8. a) For the following set of keys implement optimal Binary search tree. Draw the tree and 8
find the cost of tree.
i 0 1 2 3 4 5
Pi -- 0.08 0.05 0.12 0.20 0.10
Pj 0.05 0.11 0.05 0.11 0.10 0.04
KNT/KW/16/7353 2
www.rtmnuonline.com
www.rtmnuonline.com
9. a) Design a solution for Hamiltonian path, explain how the solution can be used to solve 6
Hamiltonian cycle problem.
b) What is Planner graph? Implement graph colouring on following graph and generate 7
solution space tree.
B F
C E
om
OR
e.c
lin
10. a) Write an algorithm to solve n - queen problem. Explain implicit & explicit constraints 8
on
associated with 8 queen problem. Give at least two solutions for 8 queen problem.
nu
m
Explain sum of subset problem. Let n = 4, M = 18 & S 6, 4, 8, 7 find all possible
.rt
b) w
w 5
subset that sum to M.
w
c) Explain 3 classes of problems class P, class NP, class NP - complete with suitable 6
om
example.
e.c
lin
OR
on
nu
m
12. a) Using Reduction write algorithm for clique and modify it to solve graph partitioned into 7
.rt
***********
KNT/KW/16/7353 3 P.T.O
www.rtmnuonline.com
www.rtmnuonline.com
om
e.c
lin
on
nu
m
.rt
w
w
w
om
e.c
lin
on
nu
m
.rt
w
w
w
KNT/KW/16/7353 4
www.rtmnuonline.com