Vous êtes sur la page 1sur 4

Set No.

Code No: 220502


II B.Tech. II-Semester Supplementary Examinations, November-2003
1
DESIGN AND ANALYSIS OF ALGORITHMS
(Computer Science and Engineering)
Time: 3 hours Max. Marks: 80
Answer any FIVE questions
All questions carry equal marks
---

1. Explain set representation using trees and develop algorithms for UNION and
FIND using weighing and collapsing rules.

2.a) Write an algorithm sort N numbers in ascending order using Merge sort.
b) Calculate the time complexity of Merge sort.

3.a) Write the control abstraction for greedy method.


b) Find an optimal solution to the knapsack instance N = 7, M = 15,
(P1,P2, P7) = (10,5,15,7,6,18,3) and (W1,W2,……… W7) = (2,3,5,7,1,4,1)?

4.a) Write a procedure DIVIDE (b,T) to implement SPLIT(b,S) instruction which


partitions a 2-3 tree T about a leaf b so that all leaves to the left of b and b itself is
in one 2-3 tree and all leaves to the right of b are in a second tree.
b) Prove that the above procedure takes time O (HEIGHT(T)) and the order of the
tree is preserved.

5.a) Design a three stage system with device types D1, D2 and D3. The costs are
Rs.30, Rs.15 and Rs.20 respectively. The cost of the system is to be no 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) What is post order traversal?


b) Write and explain a procedure for postorder traversal of a binary tree with an
example in detail. Analyze the time & space complexity of your procedure.

7. Write a program schema for a LIFO branch & bound search for a Least – cost
answer node.

8.a) Present a backtracking algorithm for solving the knapsack optimization problem
using the variable tuple size formulation.
b) Obtain a knapsack instance for which more nodes are generated by the
backtracking algorithm using a static tree than using a dynamic tree.

^^^
Set No.
Code No: 220502
II B.Tech. II-Semester Supplementary Examinations, November-2003

DESIGN AND ANALYSIS OF ALGORITHMS


2
(Computer Science and Engineering)
Time: 3 hours Max. Marks: 80
Answer any FIVE questions
All questions carry equal marks
---

1. What is meant by time complexity? Give and explain different notations used
with examples.

2. Explain the divide and conquer method with an example.

3.a) Prove that Kruskal’s algorithm generates a minimum-cost spanning tree for every
connected undirected graph G.
b) Give an algorithm to assign program to tapes.

4.a) Find an optional binary search tree for a,b,….,h if the elements, in order, have
probabilities, 0.1,0.2,0.05,0.1,0.3,0.05,0.15,0.05 and all other elements have zero
probability.
b) Find an efficient data structure for representing a subset S of the integers from 1
to n. Operations we wish to perform on the set are:
1.Select an unspecified integer from the set and delete it.
2. Add an integer i to the set.
A mechanism must be provided to ignore a request to add integer i to S in the case
where S already contains i. The data structure must be such that the time to select
and delete an element and the time to add an element are constant and
independent of ||S||.
5.a) What do you mean by forward and backward approach of problem solving in
Dynamic Programming?
b) What are the differences between Greedy and dynamic programming method of
problem solving techniques?

6. Write and explain a non-recursive algorithm for inorder traversal of a binary tree
with an example. What is the time & space complexity of your algorithm?

7.a) Write LC branch & bound to find minimum cost answer node algorithm.
b) Write a program schema DFBB for a LIFO branch and bound search for a least
cost answer node.

8. Explain the operations on polynomials of evaluation and interpolation ?

^^^
Set No.
Code No: 220502
II B.Tech. II-Semester Supplementary Examinations, November-2003

DESIGN AND ANALYSIS OF ALGORITHMS


3
(Computer Science and Engineering)
Time: 3 hours Max. Marks: 80
Answer any FIVE questions
All questions carry equal marks
---
1.a) Write a pseudo code for the implementation of UNION instruction using linked
list. Explain the working of the implementation.
b) Explain the usefulness of the following fundamental operations on serts
(i) MIN (ii) DELETE (iii) FIND (iv) UNION (v) INSERT

2.a) Explain control abstraction for divide-and-conquer strategy.


b) One way to sort a file of n records is to scan the file first merging consecutive
pairs of size one, then maging pairs of site two etc. Write an algorithm which
carries out this process. Show how your algorithm works on data set keys (100,
300, 150, 450, 250, 350, 200, 400, 500)

3. Explain the Prims’ algorithm with an example. Analyze the time complexity of the
algorithm.

4. Show that an AVL tree of height h has at most 2h+1-1 vertices and at least vertices.
h h
 5 + 2 5 1 + 2 5  5 − 2 5 1 − 5 
     −1
 5  2  5  2 

5.a) Define merging and purging rules in 0/1 knap-sack problem.


b) Given n=3, weights and profits as (wl,w2,w3)=(2,3,4), (pl,p2,p3) = (1,2,5) and
knap sack capacity M=6. Compute the sets Si. containg the pair (Pi,Wi).

6. Write and explain a non-recursive algorithm for pre-order traversal of a binary


tree with an example. What is the time & space complexity of your algorithm?

7.a) Draw the portion of the state space tree generated by LCKNAP for the knapsack
instances:
n=5, (P1,P2, ,P5) = (10,15,6,8,4), (w1 w2,...w5)=(4,6, 3, 4, 2) and M =12.
b) What do you mean by bounding? Explain how these bound are useful in branch
and bound methods?

8. A Polynomial of degree n > o has n derivatives, each one obtained by taking the
derivative of the previous one. Devise an algorithm which produces the values of
a polynomial & its n derivatives.
^^^ Set No.
Code No: 220502
II B.Tech. II-Semester Supplementary Examinations, November-2003

DESIGN AND ANALYSIS OF ALGORITHMS


4
(Computer Science and Engineering)
Time: 3 hours Max. Marks: 80
Answer any FIVE questions
All questions carry equal marks
---

1. Given three sets {1,3,5,7},{2,4,8} and {6} in which n=8 with external names 1,2
and 3 respectively with the corresponding internal names 2,3 and 1. Write the data
structure for UNION-FIND algorithm using a linked list. Then write the data
structure after UNION instruction

2.a) Devise a binary search algorithm which splits the set not into 2 sets of equal sites
but into two sets one third and two thirds. How does this algorithm compare with
binary search?
b) Suggest refinements to Merge sort to make it in-place.

3. Explain the “Job Sequencing with dead line algorithm”, applying that find the
solution for the instance n=7, (P1 P2……P7) = (3, 5, 20, 18, 1, 6) and (d 1, d2……
d7) = (1, 3, 4, 3, 2, 1, 2).

4. Use an AVL tree as the basis of an algorithm ot execute MIN, UNION, and
DELETE on sets consisting of integers 1 through n, using O(log n) steps per
operation.

5. Consider 4 elements a1<a2<a3<a4 with q0=0.25, q1=3/16, q2=q3=q4=1/16, p1=1/4,


p2=1/8,p3=p4=1/16.
(a) Construct the table of values of wij,rij,cij computed by the algorithm to
compute the roots of optimal sub trees.
(b) Construct the optimal binary search tree as a minimum cost tree.

6. Write and explain a non-recursive algorithm for postorder traversal of a binary


tree with an example. What is the time & space complexity of your algorithm?

7. Present a program schema for a FIFO branch and bound search for a Least – Cost
answer node.

8. Explain in detail how the technique of backtracking can be applied to solve the 8-
queens problem. Present an algorithm for this and explain.

^^^

Vous aimerez peut-être aussi