ADA_July-2003-04_2
-
Upload
sarir-ahmad -
Category
Documents
-
view
218 -
download
0
Transcript of ADA_July-2003-04_2
Page No ... 1
NEW SCHEME ~
MCA44
USN
FourthSemester M.C.ADegree Examination, July/August 200
Master of Computer Applications
Analysis &D sign of Algorithms
Time:3 hrs.] [Max.Marks : 10
Note:
Answer any FIVE full questions.
1. (a) Explain the concept of asymptotic notations indicating the commonlyused
notation and their significance. (10 Marks)
(b) Order the followingfunctions according to their order of growth
(n-2)!, 51092(n
+ 100)10, 2
2n
, 0.001n
4
+3n
3
+1, l09~n, -Vn,3
n
(4 Marks)
(c)Consider the followingalgorithm.
Algorithm Enigma
( A [ O . .
n
1, O . .
n
- 1 ] )
II input: Amatrix A [O . .n -1, O . .n -1] of real numbers
for
i
+-- Oton -
2
do
for
j
+--
i+
1to n - 1do
if A[i,j] t= A[j, i]
return false.
Return true :
i) What does this algorithm compute?
ii)
What is its basic operation?
iii) Howmany times is the basic operation executed?
iv) What is tl}eefficiencyclass of this algorithm.
v) Suggest an improvement or a better algorithm altogether and indicateits
efficiencyclass.
Ifyou cannot do it. try to prove hat in fact it cannot be done.
2. (a) Solve the followingrecurrence relation:
i)
x(n) =3x(n -1) for n> 1, x(l) =4
ii)
x(n)=2x(~)+nforn>1, x(l)=l, n=2k.
(6 Marksl
(b) What is a Brute force method? When does a brute force method become
applicable?
(4 Marks
(C ) Write an algorithm for selection sort.
i) Is selection sort stable?
ii) Is it possible to implement selection sort for linked list with the sam
efficiencyas the array version.
iii) Derive the ofefficiencyclass ofselection sort. (10 Marks
Contd ....
(8 Marti)
Page No... 2
MCA44
3.
(a) Write quicksort algorithm and apply it to sort list E, X, A, M, P, L, E
(10 Marks)
(b) Briefly explain a method to multiply 2 large numbers based on the divide
a n d
.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.(8Marti)
(c) Find Topological order for the below graph using both the methods.
5. (a) Sort the followinglist usi g Heapsort. Also indicate the best-case, worst case
and average case efficiency class ofHeap 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 (12 Markl)
6. (a) What is dynamic programming? Explain how it can be used to compute
binomial coefficient. Alsowrite the algorithm for the same.
(10 Marks)
,
(b) Solve all pairs hortest path problem fo the diagraph with the weight matrix.
[
~ ~
00 00
00 00
30000 00
3
o
2
1
2
4
o
t l
(10 Marks)
00
7. (a) Write Kruskal's algorithm to fmd minimum cost spanning tree. Find the
minimum cost spanning tree for the below graph. (10 Marks)
A .. .
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 ofa
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 tofind the second solution ton-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)