P. 1
Rr210504 Design and Analysis of Algorithms

Rr210504 Design and Analysis of Algorithms

|Views: 527|Likes:
Published by Srinivasa Rao G

More info:

Published by: Srinivasa Rao G on Jan 18, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

10/29/2010

pdf

text

original

Code No: RR210504

Set No. 1

II B.Tech I Semester Supplimentary Examinations, November 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) Write an algorithm to evaluate a polynomial using Horner’s rule. (b) Present an algorithm that searches for the element x in unsorted array a[1:n]. If x occurs, then return a position in the array; else return zero. Evaluate its time complexity. [8+8] 2. (a) Give the partition algorithm for Quick sort. (b) Modify the above algorithm to get the selection sort algorithm. Explain the transition. [8+8] 3. (a) Explain the terms feasible solution, optimal solution and objective function. (b) How are each of the above terms defined in i. Knapsack problem and ii. Storage on tapes. (b) Construct a 2-3 tree for the list E, X, A, M, I, N, A, T, I, O, N. [6+10] [8+8]

4. (a) Write a pseudo code for constructing 2-3 trees for a given list of n integers. 5. (a) What do you mean by forward and backward approach of problem solving in Dynamic programming? (b) What are the differences between the Greedy and Dynamic programming methods of problem solving? [8+8] 6. (a) Give an algorithm to count the number of leaf nodes in a binary tree T. What is its computing time? (b) Prove the relationship E = I + 2n, for a binary tree with n internal nodes external and the internal path length is I. [16] 7. Compare and contrast (a) Bruteforce approach Vs Backtracking (b) fixed Vs variable tuple size formulation. [8+8] 8. Define 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 Supplimentary Examinations, November 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. Write the non-recursive algorithm for finding the Fibonacci sequence and derive its time complexity. [16] 2. (a) Compute 2101 * 1130 by applying Divide and Conquer method. (b) Applying Divide and Conquer strategy, write a recursive algorithm for finding the maximum and the minimum element from a list. [8+8] 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 algorithms corresponding to ADJUST, HEAPIFY, INSERT and DELETE for the case of a min-heap represented as a complete binary tree. Explain the time complexity of HEAPIFY. [16] 5. (a) Apply Dynamic programming technique for finding an optimal order of multiplying n matrices. (b) The root of OBST always contains the key with highest search probability. Discuss the validity of the above statement. [8+8] 6. (a) Give an algorithm to count the number of leaf nodes in a binary tree T. What is its computing time? (b) Prove the relationship E = I + 2n, for a binary tree with n internal nodes external and the internal path length is I. [16] 7. Draw tree organization for the solution space of Backtracking algorithm for (a) 4-queens problem and (b) Sum of subsets (n=4) and explain. [8+8]

8. Present a program schema for a FIFO Branch & Bound search for a Least-Cost answer node. [16] ⋆⋆⋆⋆⋆

1 of 1

Code No: RR210504

Set No. 3

II B.Tech I Semester Supplimentary Examinations, November 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) Write an algorithm to evaluate a polynomial using Horner’s rule. (b) Present an algorithm that searches for the element x in unsorted array a[1:n]. If x occurs, then return a position in the array; else return zero. Evaluate its time complexity. [8+8] 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) Write an algorithm for checking whether an array H [1,2,.......,n] is a heap or not. (b) Determine the time efficiency of the above algorithm. 5. (a) Show that the computing time of OBST algorithm is O(n2 ). (b) Write an algorithm to construct Optimal binary search tree given the roots R(i,j), 0<=i<j<=n. Show that the time complexity of the algorithm is O(n). [8+8] 6. (a) Write an algorithm that uses BFS traversal to determine if the undirected and directed graphs are cyclic? (b) Show that the time complexity of the above algorithm is of the order n. [10+6] 7. Define the following terms: state space, explicit constraints, implicit constraints, problem state, solution states, answer states, live nod, E-node, dead node, bounding functions. [16] 8. (a) Define the term Branch & Bound and explain with an example. (b) Explain the properties of LC- Search. ⋆⋆⋆⋆⋆ [10+6] [8+8]

1 of 1

Code No: RR210504

Set No. 4

II B.Tech I Semester Supplimentary Examinations, November 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 complex valued matrix X is represented by a pair of matrices (A,B) where A and B contain real values. Write an algorithm that computes the product of two complex valued matrices (A,B) and (C,D) where (A,B) * (C,D) = (A+iB) * (C+iD) = (AC-BD) + i (AD+BC). Determine the number of additions and multiplications if all the matrices are all n×n. [16] 2. (a) Trace the Merge sort algorithm for the given array. Also show the tree of calls for Merge sort. 25, 57, 48, 37, 12, 92, 25, 86, 33 (b) Use Insertion sort technique to improve Quick sort. [8+8] 3. (a) Write Prim’s algorithm under the assumption that the graphs are represented by adjacency lists. (b) Analyze precisely the computing time and space requirements of this new version of Prim?s algorithm using adjacency lists. [10+6] 4. (a) Construct a 2-3 tree for the list E, X, A, M, I, N, A, T, I, O, N. (b) Construct the neap tree for the list E, X, A, M, I, N, A, T, I, O, N. [8+8] 5. (a) Design a three stage system with device types D1 , D2 , D3 . The costs are Rs.30, Rs.15 and Rs.20 respectively. The cost of the system is to be not more than Rs.105. The reliability of each device type is 0.9, 0.8 and 0.5 respectively. (b) Explain in detail the reliability design problem. 6. (a) Explain the depth first search algorithm for an undirected graph. (b) Define a binary search tree. (c) Write a possible linearly ordered binary search tree in lexographic order for the keywords begin, else, end, if, then. [8+4+4] 7. (a) Prove that the number of all subsets of n elements is 2n . (b) Give the algorithm to generate a breadth first solution tree of the AND/OR tree. [8+8] 8. (a) Which of the solutions to the traveling salesperson problem is efficient: Dynamic programming or Branch & Bound? Explain. (b) Can FIFOBB be applied to Traveling Salesperson problem? Justify. ⋆⋆⋆⋆⋆ 1 of 1 [8+8] [10+6]

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->