Sunteți pe pagina 1din 3

Page No ...

I
Answer

MCA44 NEW SCHEME ~

USN
Master of Computer Applications

Fourth Semester M.C.A Degree Examination, July/August 2004

Analysis & Design of Algorithms


Time:3 hrs.]

[Max. arks : 100 M any FIVE full questions.


(10 Marks)

Note:

1. (a) Explain the concept of asymptotic notations indicating the commonly used
notation and their significance. (b) Order the following functions according to their order of growth (n-2)!, 51092(n

+ 100)10,

22n, 0.001n4+3n3+1,

l09~n, -Vn,3n

(4 Marks)

(c) Consider the following algorithm. Algorithm Enigma (A[O .. n -1, O.. n -1]) II input: A matrix A[O .. n -1, O.. n -1] of real numbers for i +-- Oto n - 2 do for j +-- i + 1 to n - 1 do if A[i,j] t= A[j, i] return false. Return true : i)
ii)

What does this algorithm compute? What is its basic operation?

iii) How many times is the basic operation executed? iv) What is tl}e efficiency class of this algorithm. v) Suggest an improvement or a better algorithm altogether and indicate its efficiency class. If you cannot do it. try to prove that in fact it cannot be done.
(6 Marks)

2. (a) Solve the followingrecurrence relation:


i)

x(n) = 3x(n -1) for n> 1, x(l) = 4 x(l)=l, n=2k.


(6 Marksl

ii) x(n)=2x(~)+nforn>1,

(b) What is a Brute force method? When does a brute force method becomes applicable? (4 Marks
(C)

Write an algorithm for selection sort. i)


ii)

Is selection sort stable?

Is it possible to implement selection sort for linked list with the sam~ efficiency as the array version.
(10 Marks

iii) Derive the of efficiency class of selection sort.

Contd ....

Page No... 2

MCA44
(10 Marks)

3. (a) Write quicksort algorithm and apply it to sort list E, X, A, M, P, L, E (b) Briefly explain a method to multiply 2 large numbers based on the divideand .conquer method. Hence compute the 1234 x 2101 using the same. (10 Marka) 4. (a) Explain how connectivity and acyclicity of a graph can be checked.
(4 Marti)

(b) Write Breadth-First search algorithm and indicate its efficiency class.(8 Marti) (c) Find Topological order for the below graph using both the methods.
(8 Marti)

5. (a) Sort the following list using Heapsort. Also indicate the best-case, worst case
and average case efficiency class of Heap sort List ~ 5, 0, R, T, I, N, G (8Marks)

(b) Write the Horspool's algorithm to count the number of occurrence of a pattern in the given string. Find the shift table for the pattern 'BARBER' and hence search for the pattern 'BARBER'in the input text -

JIM ~ SAW ~ ME ~ IN ~ A ~ BARBERSHOP 6. (a) What is dynamic programming?

(12 Markl)

Explain how it can be used to compute binomial coefficient. Also write the algorithm for the same. (10 Marks)

(b) Solve all pairs shortest path problem for the diagraph with the weight matrix.
00

~
00 00

~
00 00

o
2

1 2 4

30000

00

7. (a) Write Kruskal's algorithm to fmd minimum cost spanning tree. minimum cost spanning tree for the below graph.
A...

tl

(10 Marks)

Find the
(10 Marks)

Page No ... 3

MCA44

(b) Write Dijkstra's algorithm to solve single source shortest path problem. What changes must be done to find the shortest path between 2 given vertices of a weighted graph? (10 Marks)

8. (a) Compare and contrast the back tracking and brand-and-bound

methods.
(4 Marks)

(b) Find one solution to 4-queens problem using state-space tree. Explain how board's symmetry can be used to find the second solution to n-queens problem. Hence find the other solution to 4-queens problem. (8 Marks) (c) Write a brief note on NP-complete problems and approximation algorithms.
(8 Marks)

** * **

S-ar putea să vă placă și