# Code No: RR210504

Set No. 1

II B.Tech I Semester Supplementary Examinations, February 2007 DESIGN AND ANALYSIS OF ALGORITHMS ( Common to Computer Science & Engineering, Information Technology and Computer Science & Systems Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Deﬁne an algorithm. Describe the characteristics of the algorithm. (b) Write an algorithm to ﬁnd largest of given ‘n’ numbers. Derive its time complexity. Using big-oh notation. 2. (a) Analyze the average case time complexity of Quick sort. (b) Derive the time complexity for Binary Search. [10+6] [8+8]

3. (a) Explain the terms feasible solution, optimal solution and objective function. (b) How are each of the above terms deﬁned in i. Knapsack problem and ii. Storage on tapes. [6+10]

4. Write an algorithm to split the AVL tree and to concatenate two AVL trees. The algorithm should work in time proportional to the height of the tree. [16] 5. (a) What is a Traveling sales person’s problem and what are its applications? (b) For the traveling salesperson algorithm, show that the time complexity is O(n2 2n ) and space complexity is O(n2n ). [8+8] 6. Write an algorithm for breadth ﬁrst traversal so that all connected components of an undirected graph G are printed out. Assume that G is the input in adjacency list with HEAD as the head node for the adjacency list. [16] 7. Write an algorithm to determine whether or not the given AND/OR graph G represents a solvable problem. Devise a suitable representation for the above problem. [16] 8. Deﬁne dominance relations. Does the use of the dominance relations result in the generation of more nodes than the nodes that would otherwise be generated? Justify. [16] ⋆⋆⋆⋆⋆

1 of 1

Code No: RR210504

Set No. 2

II B.Tech I Semester Supplementary Examinations, February 2007 DESIGN AND ANALYSIS OF ALGORITHMS ( Common to Computer Science & Engineering, Information Technology and Computer Science & Systems Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Given the n points (xi , yi ), 0<=i<=n-1 where yi is an integer, determine an algorithm which produces the unique interpolating polynomial of degree<=n. (b) Write the algorithms for Sparse and Straightforward evaluation of polynomials. [8+8] 2. (a) Compute 2101 * 1130 by applying Divide and Conquer method. (b) Applying Divide and Conquer strategy, write a recursive algorithm for ﬁnding the maximum and the minimum element from a list. [8+8] 3. Explain the Job sequencing with dead line algorithm and also ﬁnd the solution for the instance n=7, (P1 , P2 , ......., P7 )=(3,5,20,18,1,6,30) and (D1 , D2 , ......., D7 )=(1,3,4,3,2,1,2). [16] 4. Write an algorithm for heap sort. Trace the algorithm to sort the following list of numbers. 8, 20, 9, 4, 15, 10, 7, 22, 3, 12. Analyze its time complexity. [16] 5. (a) Give an algorithm for solving multistage graph problem using backward approach when the graph is represented by using adjacency list. (b) Test the correctness of the above problem using a suitable graph. (c) What is its time complexity? [8+4+4] 6. (a) Write a non-recursive algorithm for the in-order traversal of a binary tree T. Each node has four ﬁelds: LCHILD, DATA, PARENT, RCHILD. (b) The preorder and postorder sequences of a binary tree do not uniquely deﬁne the binary tree. Justify your answer. [8+8] 7. Write an algorithm to determine whether or not the given AND/OR graph G represents a solvable problem. Devise a suitable representation for the above problem. [16] 8. Given instance is, n=5, (p1 , p2 .....p5 ) =(10,15,6,8,4), (w1 , w2 , ....., w5 )=(4,6,13,4,2) and m=12. Give relevant diagrams and suitable explanations to solve this by using (a) LCBB and (b) Dynamic programming. ⋆⋆⋆⋆⋆ 1 of 1 [10+6]

Code No: RR210504

Set No. 3

II B.Tech I Semester Supplementary Examinations, February 2007 DESIGN AND ANALYSIS OF ALGORITHMS ( Common to Computer Science & Engineering, Information Technology and Computer Science & Systems Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. (a) Deﬁne space complexity. Explain the same with an example. (b) Deﬁne big oh notation. Explain the terms involved in it. Give an example. [6+10] 2. (a) Design a Divide and Conquer algorithm for computing the number of levels in a binary tree. (b) Compute the complexity of the above algorithm. [10+6] 3. (a) Given a set of ‘n’ programs and lengths of each program, derive the time complexity to store the programs in increasing order of their lengths. (b) Explain the control abstraction of Greedy method. [10+6] 4. (a) What is a priority queue? What are the various representations of priority queues? (b) What is a heap? Diﬀerentiate between heap and binary search tree. (c) Prove that Heap (T) of sorting n keys has a height of ⌈log(n + 1)⌉ . [5+5+6] 5. (a) Deﬁne Merging and purging rules in 0/1 Knapsack problem. (b) Given n=3, weights (w1 , w2 , w3 )= (18,15,10), proﬁts (p1 , p2 , p3 )=(25,24,15) and the knapsack capacity m=20. Compute the sets S i containing the pair (Pi .Wi ). [8+8] 6. (a) What is the postorder traversal? (b) Write and explain a procedure for the post order traversal of a binary tree with an example. Analyze the space and time complexity of the procedure. [2+14] 7. (a) What are Game trees? What are its applications? (b) Deﬁne uniform game tree, random game tree and totally dependent game tree. [8+8] 8. (a) Explain the solution to the Traveling sales person problem using LCBB. (b) Is the above technique applicable for a non-symmetric distance matrix? Substantiate. [8+8] ⋆⋆⋆⋆⋆ 1 of 1

Code No: RR210504

Set No. 4

II B.Tech I Semester Supplementary Examinations, February 2007 DESIGN AND ANALYSIS OF ALGORITHMS ( Common to Computer Science & Engineering, Information Technology and Computer Science & Systems Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE Questions All Questions carry equal marks ⋆⋆⋆⋆⋆ 1. If A(x) = an xn + ....... + a1 x + a0 , then the derivative of A(x), A′ x) = nan xn−1 + ........ + a1 . Write an algorithm that produces the value of a polynomial and its derivative at a point x=v. Determine the number of required arithmetic operations. [16] 2. (a) Analyze the average case time complexity of Quick sort. (b) Derive the time complexity for Binary Search. 3. (a) Apply Greedy technique to solve Traveling salesperson problem. (b) Does the above algorithm generate a minimum length tour? Justify your answer. [16] 4. Write an algorithm for heap sort. Trace the algorithm to sort the following list of numbers. 8, 20, 9, 4, 15, 10, 7, 22, 3, 12. Analyze its time complexity. [16] 5. (a) Give an algorithm for solving multistage graph problem using backward approach when the graph is represented by using adjacency list. (b) Test the correctness of the above problem using a suitable graph. (c) What is its time complexity? 6. (a) What are the applications of traversal techniques? (b) Given, Preorder: A B C D E F G H I In order: D C E B F A H G I Find the postorder sequence and draw the corresponding binary tree. [8+4+4] [10+6]

[6+10]

7. Discuss the relevance of Backtracking technique to m-coloring graph. Explain with an example. [16] 8. Given instance is, n=5, (p1 , p2 , ....., p5 )=(w1 , w2 , ....., w5 )=(4,4,5,8,9) and m=15. Solve this by using (a) Greedy method and (b) FIFOBB. Draw the state space tree. ⋆⋆⋆⋆⋆ [6+10]

1 of 1