Sei sulla pagina 1di 4

Code No: RR210504 Set No.

1
II B.Tech I Semester Supplimentary Examinations, February 2008
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. Define time complexity. Describe different notations used to represent these com-
plexities. Illustrate with suitable examples. [16]
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) 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 profit-weight ratio is arranged in non-increasing
order. [8+8]
4. (a) Write an algorithm to combine two heaps into a single heap.
(b) Show that if all the internal nodes in a tree have degree k and the number of
external nodes n then n mod (k-1) =1. [8+8]
5. (a) Explain the general Dynamic Programming problem.
(b) What is the Principle of Optimality? Explain its significance. [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. Explain the principles of
(a) Control Abstraction for LC-search
(b) Bounding
(c) FIFO Branch & Bound
(d) LIFO Branch & Bound [4+4+4+4]

⋆⋆⋆⋆⋆

1 of 1
Code No: RR210504 Set No. 2
II B.Tech I Semester Supplimentary Examinations, February 2008
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) Modify the Binary search of the text so that in the case of unsuccessful search
it returns the index i such that k(i) <key < k(i+1).
(b) Is Quick sort a stable sorting method? Justify your answer. [8+8]
3. Explain the algorithm for Job sequencing with deadlines. Applying the same, find
the solution for the instance n = 4, (p1 .....p4 )=(100,10,15,27) and (d1 .....d4 )=(2,1,2,1).
[16]
4. Explain the set representation using tree and develop algorithms for UNION and
FIND using Weighing and Collapsing rules. [16]
5. The edge length of a directed graph are given by the below matrix. Using the
traveling salesperson algorithm, calculate the optimal tour. [16]
 
0 20 30 10 11
 15 0 16 4 2 
 
 3 5 0 2 4 
 
 19 6 18 0 3 
16 4 7 16 0
6. (a) Present an algorithm for depth first search traversal. Explain with an example.
(b) Write a detailed note on breadth first traversal. [10+6]
7. (a) Write a Backtracking algorithm for solving the Knapsack optimization prob-
lem using the variable tuple size formulation.
(b) Obtain a Knapsack instance for which nodes are generated by Backtracking
algorithm using a static tree than using a dynamic tree. [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, February 2008
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) Modify the Binary search of the text so that in the case of unsuccessful search
it returns the index i such that k(i) <key < k(i+1).
(b) Is Quick sort a stable sorting method? Justify your answer. [8+8]

3. (a) What is a minimum spanning tree? What are its applications?


(b) Design an algorithm for finding a maximum spanning tree of a weighted con-
nected graph. [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. Explain the Multistage graph problem. Name the design technique that can solve
this problem. Write the algorithm and explain its working with the help of an
example. [16]

6. (a) Show that the inorder and post order sequences of a binary tree uniquely
define the binary tree.
(b) Write a detailed note on depth-first traversal. [10+6]

7. Compare and contrast

(a) Bruteforce approach Vs Backtracking


(b) fixed Vs variable tuple size formulation. [8+8]

8. (a) Write a program to solve the Knapsack problem with Branch & Bound algo-
rithm.
(b) Write the algorithm for LC search least cost answer node. [9+7]

⋆⋆⋆⋆⋆

1 of 1
Code No: RR210504 Set No. 4
II B.Tech I Semester Supplimentary Examinations, February 2008
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) Give the one-step Chinese Remainder algorithm.


(b) Using the above algorithm, find all the solutions to the equations
x ≡ 2 (mod 5) and x ≡ 3 (mod 13). [8+8]
2. (a) Trace the Quick sort algorithm to sort the list C, O, L, L, E, G, E in alpha-
betical order.
(b) Give an instance, where the Quick sort algorithm has worst case time com-
plexity. [12+4]
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) Write a pseudo code for constructing 2-3 trees for a given list of n integers.
(b) Construct a 2-3 tree for the list E, X, A, M, I, N, A, T, I, O, N. [8+8]
5. (a) Apply Dynamic programming technique for finding an optimal order of mul-
tiplying 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) Show that the inorder and post order sequences of a binary tree uniquely
define the binary tree.
(b) Write a detailed note on depth-first traversal. [10+6]
7. (a) What are Game trees? What are its applications?
(b) Define uniform game tree, random game tree and totally dependent game tree.
[8+8]
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. [10+6]

⋆⋆⋆⋆⋆

1 of 1

Potrebbero piacerti anche