# www.andhracolleges.

Code No: RR210504

Set No. 1

II B.Tech I Semester Supplementary Examinations, March 2006 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 ⋆⋆⋆⋆⋆

www.andhracolleges.com
i. worst case ii. best case iii. average case (c) If f(n) = am nm +......+a1 n+a0 and am >0 , then prove that f(n) = θ (nm ). 2. (a) Explain when the Quick sort is preferred to merge sort and vice-versa. (b) Write a linear time algorithm that generates the OBST from the root table.

1. (a) Order the following functions according to their order of growth (from the lowest to the highest). (n-2)! , 5 log (n+100) 10,22n , 0.001n4 +3n3 +1, ln2 n, n1/3 , 3n (b) Use the most appropriate notation among O, θ and Ω to indicate the time eﬃciency class of sequential search in the

[5+3+8)

(b) What is the principle of Partitioning in Quick sort? Give the algorithm.[8+8]

www.andhracolleges.com
7. (a) What are Game trees? What are its applications?
www.andhracolleges.com

3. (a) Compute the time complexity of deriving minimum spanning tree from the weighted connected graph using Kruskal’s algorithm. (b) Prove that Greedy Knapsack generates optimal solution to the given instance of Knapsack problem, when the proﬁt-weight ratio is arranged in non-increasing order. [8+8]

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) Describe the Dynamic Programming approach for the construction of OBST for a set of n keys, if all keys are equally likely to be searched for. [8+8] 6. (a) Show that the inorder and preorder sequences of a binary tree uniquely deﬁne the binary tree. (b) Write an algorithm to construct the binary tree with the given inorder sequence I and postorder sequence P. What is the time complexity of the algorithm used? [8+8]
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications 1 ofUSA-UK-Australia-Germany-France-NewZealand Universities List 2 Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information

Code No: RR210504

Set No. 1

(b) Deﬁne uniform game tree, random game tree and totally dependent game tree. [8+8] 8. Explain the principles of (a) Control Abstraction for LC-search

www.andhracolleges.com
(c) FIFO Branch & Bound (d) LIFO Branch & Bound ⋆⋆⋆⋆⋆

(b) Bounding

[4+4+4+4]

www.andhracolleges.com
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications USA-UK-Australia-Germany-France-NewZealand Universities List www.andhracolleges.com Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information

2 of 2

Code No: RR210504

Set No. 2

II B.Tech I Semester Supplementary Examinations, March 2006 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 ⋆⋆⋆⋆⋆

www.andhracolleges.com
2. (a) Compute 2101 * 1130 by applying Divide and Conquer method. 5. (a) Deﬁne Merging and purging rules in 0/1 Knapsack problem. 6. (a) Show that DFS visits all vertices in G reachable from v.

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]

(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 algorithm for Job sequencing with deadlines. Applying the same, ﬁnd the solution for the instance n = 4, (p1 .....p4 )=(100,10,15,27) and (d1 .....d4 )=(2,1,2,1). [16] 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]

www.andhracolleges.com
⋆⋆⋆⋆⋆
www.andhracolleges.com

(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]

(b) Show that the number of leaves in a binary tree is more than the number of nodes of degree two. [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. Present a program schema for a FIFO Branch & Bound search for a Least-Cost answer node. [16]

Seminar Topics - Scholarships - Admission/Entrance Exam Notifications 1 ofUSA-UK-Australia-Germany-France-NewZealand Universities List 1 Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information

Code No: RR210504

Set No. 3

II B.Tech I Semester Supplementary Examinations, March 2006 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 ⋆⋆⋆⋆⋆

www.andhracolleges.com
2. Explain the Divide and Conquer method with an example. (b) Explain in detail the reliability design problem.

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] [16]

3. (a) Applying the Greedy strategy, ﬁnd the solution for optimal storage on tapes for the problem instance n=3, (l1 , l2 , l3 ) = (5,10,3). (b) Explain the 0/1 knapsack problem algorithm with the Greedy method. Show that this strategy doesn’t necessarily yield optimal solution. [6+10] 4. (a) In the problem of maintaining a ‘changing set’ S of elements, delete some of the old elements and ﬁnd whether an element ‘b’ is in the set S. Can this be modeled by a dictionary? Write the three fundamental set operations needed to implement the solution of the problem.

www.andhracolleges.com
7. (a) Explain the nim game. (b) Generate the complete game tree for nim with n=6.
www.andhracolleges.com

(b) Implement a technique to handle INSERT, MEMBER and DELETE instructions. Explain the scheme with a suitable sketch. [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. [10+6]

6. (a) Design an algorithm to delete a vertex from binary search tree so that the result is still a binary search tree. (b) Prove that the BFS algorithm visits all the vertices reachable from the beginning vertex v. [8+8]

[8+8]

8. (a) Draw the portion of the state space tree generated by LCBB for the knapsack instance: n=5, (p1 , p2 , ....., p5 )=(10,15,6,8,4), (w1 , w2 , ......, w5 )=(4,6,3,4,2) and m=12.
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications 1 ofUSA-UK-Australia-Germany-France-NewZealand Universities List 2 Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information

Code No: RR210504

Set No. 3

(b) What do you mean by bounding? Explain how these bounds are useful in the Branch and Bound method. [10+6] ⋆⋆⋆⋆⋆

www.andhracolleges.com www.andhracolleges.com
Seminar Topics - Scholarships - Admission/Entrance Exam Notifications 2 ofUSA-UK-Australia-Germany-France-NewZealand Universities List 2 www.andhracolleges.com Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information

Code No: RR210504

Set No. 4

II B.Tech I Semester Supplementary Examinations, March 2006 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 ⋆⋆⋆⋆⋆

www.andhracolleges.com
1. (a) Deﬁne an algorithm. Describe the characteristics of the algorithm. 2. (a) Compute 2101 * 1130 by applying Divide and Conquer method. 3. (a) What is a minimum spanning tree? What are its applications? 4. (a) What are Dictionaries? Explain. 8. (a) Give the algorithm for LCBB for the 0/1 Knapsack problem.

(b) Write an algorithm to ﬁnd largest of given ‘n’ numbers. Derive its time complexity. Using big-oh notation. (8+8)

(b) Applying Divide and Conquer strategy, write a recursive algorithm for ﬁnding the maximum and the minimum element from a list. [8+8]

(b) Design an algorithm for ﬁnding a maximum spanning tree of a weighted connected graph. [6+10]

(b) What is a balanced tree? Diﬀerentiate between 2-3 trees and AVL trees.[6+10] 5. Consider the Knapsack instance n=6, m=165, (p1 , p2 , ....., p6 ) = (w1 , w2 , ......, w6 ) = (100,50,20,10,7,3). Generate the Si sets containing the pair (pi , wi ) and thus ﬁnd the optimal solution. [16] 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]

www.andhracolleges.com
⋆⋆⋆⋆⋆ 1 of 1
www.andhracolleges.com

7. Discuss the relevance of Backtracking technique to m-coloring graph. Explain with an example. [16]

(b) Compare the eﬃciencies of FIFO, LIFO and LC Branch & Bound algorithms. [8+8]

Seminar Topics - Scholarships - Admission/Entrance Exam Notifications USA-UK-Australia-Germany-France-NewZealand Universities List Engineering-MBA-MCA-Medical-Pharmacy-B.Ed-Law Colleges Information