You are on page 1of 1

Code: R7310506

R7
DESIGN AND ANALYSIS OF ALGORITHMS
(Computer Science and Engineering)

B.Tech III Year I Semester (R07) Supplementary Examinations December/January 2013/14

Time: 3 hours
Answer any FIVE questions All questions carry equal marks ***** 1 (a) (b) 2 (a) (b) Write an algorithm for transpose of a matrix by using step count method. Discuss the different approaches to find the time complexity of algorithm.

Max Marks: 80

Explain the different set operations with suitable examples. Prove that if G is a connected undirected graph with n vertices and n 1 edge, then G is a tree. Present a pseudo code for quick sort by using randomized technique. Draw the tree of calls for the merge sort by the following set of elements (179, 285, 310, 351, 652, 254, 423, 450, 520 and 861). Find optimal solution for the following knapsack problem: n = 3, m = 20, (P1,P2,P3) = (25,24,15) and (W 1,W 2,W3) = (18,15,10). Define the following terms: (i) Feasible solution. (ii) Optimal solution. (iii) Object function.

3 (a) (b)

4 (a) (b)

5 (a) How would you construct an optimal binary search tree for a set of n keys if all the keys are equally likely to be searched for? What will be the average number of comparisons in the tree if n = 2k? (b) Write a pseudo code of the bottom-up dynamic programming algorithm for the knapsack problem. 6 (a) Write a backtracking algorithm for solving the knapsack optimization problem using the variable tuple size formulation. (b) Explain in detail how the technique of backtracking can be applied to solve the 8-queens problem. 7 (a) Prove the validity of the lower bound given by form (11, 2) for instances of the traveling sales man problem with integer symmetric matrix of intercity distances. (b) How would you modify lower bound (11, 2) for non symmetric distance matrices? 8 (a) Write short notes on: (i) Classes of NP-hard. (ii) Classes of NP-complete. How are P and NP problems related? *****

(b)