Professional Documents
Culture Documents
:
Question Paper Code : 11255
B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2011
Fourth Semester
Computer Science and Engineering
CS 2251 DESIGN AND ANALYSIS OF ALGORITHMS
(Regulation 2008)
Time : Three hours
n
i
Maximum : 100 marks
s.
t
n
PART A (10 2 = 20 marks)
e
1. Using the step count method analyze the time complexity when 2 m
n
d
matrices are added.
u
t
2. An array has exactly n nodes. They are filled from the set {0, 1,
2,...,n-1, n}.
s
There are no duplicates in the list. Design an O(n) worst case time algorit
hm to
a
i
find which one of the elements from the above set is missing in the array.
d
3. Show the intermediate steps when the numbers 123, 23, 1, 43, 54, 36, 75, 34
n
i
are sorted using merge sort.
.
4.
e
Devise an algorithm to make a change for 1655 using the Greedy strategy. Th
w
coins available are {1000, 500, 100, 50, 20, 10, 5}.
w
5.
6.
Write an algorithm to find the shortest path between all pairs of nodes.
7.
8.
9.
he
Define a strongly connected digraph and give the minimum in degree of all t
t
(b) Using the divide and conquer approach to find the maximum an
d
s
minimum in a set of n elements. Also find the recurrence relation for th
e
a
number of elements compared and solve the same.
i
13. (a) Use function OBST to compute w(i, j), r(i, j), and c(i, j), 0<=i<j<=4,
for the
d
identifier set (
) = (cout, float, if, while) with p(1) = 1/20,
p(2) =
a a , a , a ,
1 2 3 4 n
1/5, p(3) = 1/10, p(4) = 1/20, q(0) = 1/5, q(1) = 1/10, q(2) = 1/5, q(
3) = 1/20,
i
and q(4) 1/20. Using the r(i, j)s, construct the optimal binary search
tree.
.
w
Or
(b) Using dynamic approach programming, solve the following graph u
sing
the backward approach.
w
w
2
11255
----------------------- Page 3----------------------14. (a) Using backtracking, find the optimal solution to a knapsack problem fo
r
the knapsack instance n = 8, m = 110, (p , p . ... p ) = (11, 21, 31,
33, 43,
1 2
7
53, 55, 65) and (w , w ,...,w ) = (1, 11, 21, 33, 43, 53, 55, 65).
1 2
7
Or
(b) Write an algorithm for N QUEENS Problem and Trace it for n=6.
15. (a) Write the Kruskals algorithm apply it to find a minimum spanning tree
for the following graph :
n
i
s.
t
Or
n
e
(b) Write short notes on NP-hard and NP-completeness.
d
u
t
s
a
i
d
n
i
w.
w
w
3
11255