0% found this document useful (0 votes)
19 views4 pages

MCS-031 08

Uploaded by

Nitin Singhal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

MCS-031 08

Uploaded by

Nitin Singhal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MCA (Revised)

Term-End Examination
o)
@ December,2A08
r-l
o) MCS-031:DESIGN AND ANALYSIS OF
c)
ALGORITHMS
Time : 3 hours Maximum Marks : L00
Note : Questionnumber1,is compulsory.Attempt any three
questions
from therest. All algorithrnsshouldbewritten
nearerto C/C++ language. Parts of the samequestion
should be attemptedtogether.

1. (a) (0 What is the difference between a


O(big-oh) and O(little-oh) notations.
Which of these notations is not
asymptotically tight
(ii) Arrange the following in the order of
worst to best efficiency :
O(nIogn), O(Zn),O(tog n21,O1n27
(b) Write an algorithm (an informal algorithm
is sufficient) to find the ith order statistic,
which ensures that the worst caserunning
time to selectan element isO(n), i.e., linear.
(c) (0 Discuss informally that a recursive
solution to matrix-chain multiplication
is exponential in nature.
(ii) If, both dynamic programming and
grebdy approaches are applicable to
a given problem, then which
approach would generally give a
faster solution, and why ?
(d) What is the benefit of randomization in
quicksort algorithm ?
(e) What are non-regular languages ? Can we
use context free grammar to generate
regular as well as non-regular languages ?
If yes, then give an example of each.
(f) \tVhat is the difference between polynomial
time and non-polyriomial time algorithms ?

2. (a) Discuss the role of optimal substructure


property in applying a greedy algorithm to
solve a given problem.
(b) (0 Analyze the worst case running time
of merge sort on n numbers.
(ii) Given an array of elements :
5 12 , 9 , 4 , 3 , 7 ,6 , 8
If we apply quick sort algorithm on
the above array then, what is the
minimum and maximum number of
times, each element would be
compared to others.
(c) Write Dijkstra's Algorithm to find shortest
path to a given node in an undirected
weighted graph.
3. (u) Explain how binary search algorithm
. performs more efficiently than linear search
algorithm. Compare their running times.
(b) Write a recursive function to find/calculate
the sum of all elementsin an integer aftay.
(") Describe,how alpha betapruningsaves time
as compared to minimax-procedure in a
two player game. You can use an example.
(d) What is preconditioning ? Explain how
preconditioning is useful in finding a
solution to a problem.

4. (a) Design a turing machine that accept


collection of all strings with an even number
of a's and an even number of b's over the
alphabet2: {a, b}.
(b) Using Kruskal's algorithm, construct a
minimum spanning tree from the following
graph:

(") Wtite a context free grammar that can


generate the language represented by the
regular expression(b*a b*a !*)*
J. (u) While applying Depth First Search in a
directed graph, how do we differentiate
between a cross edge and a forward edge
with respect to the discovery time (i.e., the
time at which a vertex become known) of
its end vertices.
(b) (r) What language is represented by the
regular expression6*a !*(ab*ab*)*.
(ii) Define pumping lemma for regular
languages.
(c) \A/hat is the difference between divide and
conquer approach and dynamic
programming approach to solve.problems.
(d) Define an NP-hard problem. Give an
example also.

-oOo-

You might also like