No.
of Printed Pages : 4
MCA (Revised)
lc)
Term-End Examination
December, 2012
N14
V)
MCS-031
MCS-031 : DESIGN AND ANALYSIS OF
ALGORITHMS
Time : 3 hours Maximum Marks : 100
Note : Question No.1 is compulsory. Attempt any three from
the rest of questions.
1. (a) (i) Prove that function f (x) = 5x4 + 7x +3
is 0 (x4). Is f (x) also 0 (x4) ? Explain.
5+2=7
(ii) Arrange the following growth rates in
3
increasing order of time :
0(x3), 0(2x), 0(x2), 0(,5 log x),
0(x log x), 0(x2 log x)
(b) (i) Differentiate between dynamic 5
programming and greedy approach
to solve different problems.
(ii) Write a recursive function to multiply
5
two natural numbers.
(c) (i)
Define a Kleene Star (*) of a language
7
L. Prove that if L is context free then
L* is also context free.
MCS-031 1 P.T.O.
(ii) Explain the difference between Push
3
Down Automata (PDA) and Finite
Automata (FA).
(d) (i)
Define 'Halting Problem" of Turing
Machines.
(ii) Show stepwise sorting of elements
using Heapsort algorithm to the
following max heap.
2. (a) (i) Define ambiguity in Context-Free 4
Grammar (CFG). Show that the
grammar :
E--->E+E/E*E/a is ambiguous.
(ii) If L1 and L2 are two Context-Free 3
languages, then show that L1.L2 is also
Context - Free language.
MCS-031 2
(b)
Use Prim's algorithm to construct a
8
minimum spanning tree from the following
graph (by using starting node A).
(c)
Write a short note on NP-hard problems.
5
3.
(a) Explain the complete steps of Strassen's 10
algorithm for multiplying two (n x n)
matrices.
Show that the Running time of Strassen's
Algorithm is 0 (n2.81).
(b) Build regular grammar and corresponding 10
finite automata (FA) for the following
languages over the alphabet {a, b}.
(i)
Language in which words do not end
with ab.
(ii)
Language having even number of a's.
MCS-031 3 P.T.O.
4. (a) Describe 0-1 Knapsack problem. Which 7
approach among greedy algorithm or
dynamic programming is applicable for this
problem ?
(b) Write a Dijkstra's algorithm for single source 10
shortest path problem. Apply Dikstra's
Algorithm for the following graph :
(c) What is the best case, average case and
3
worst case running time of merge sort ?
5. (a) (i) Explain the purpose of randomization 4
of quicksort.
(ii) What is the best case running time of 4
quicksort ? In which situation does it
occur ?
(b) Why do we perform amortized analysis of 5
a problem ?
(c)
Define 0 notation and 0 notation. Explain, 7
how these two notations are different.
MCS-031 4