You are on page 1of 3

(

I
I
Eft\rr
\

TJSN 1scs43

Fourth Semester B. [',]. Degree Exar,u in'ation, .Iu nel,lyIy 201 8


Design and Analprsls of Algorithms
Tirne: 3 hrs, Max. Marl<s: ti0
Note: Answcr an)' FIVE full questions, choosing
{)
()i\li iull question lrnm each module.
.9
C)
5_

=E
rJn
a. Write an algorithnr to,find thc nraximum clcmcnt in an array of'n clcnrcnt. (iivc thc
u mathematicsl anafrTsis of this non-recursive algoritlrm, (06 Ntarks)
,
Il_
.a-J b. Explain the. asymptotic notations lligO. IligQ and big thcta used to comparc ordcrs of'
ofan"a,igorithm.
(n A\

c!- growth ({)6 Marks)


'- c. Explain rarit[r an example how a new variablc count introcluccd in a progranr can bc uscd to
-v?
c
dU
7tr)
find the number of steps nccded by a program to solvc a particular pnrblcm instancc.
oO
coo
tl
1' . (04 Nlarks)
.=A
.d$
OR
H7)
OC
/)
LL. Write a recursive function to flnd and print all possiblc pcrnrutations o1' a givt:n :,et o1'
53
c tl c le rnc nts . (05 \Iarks)
8n b. So lve the recurrence relation M(n)-2M(n l) | l.'l'al<e M(l) -.1., I\'l( n) rs g ivc n lo r'
tl
:

L1)
(f.)
Cc
,1
n) l. (05 Marks)
c. Dcflne aigorithm. What are thc criteria that an algrtrithm lltust satisfvl' (06 i\{ arks)
') i)
,. L.

E!_
Module-2
?5
a. Write a function to find thc maximum and minimum clement:i in a givcn arrat ol'n clcrncrrts
\ by applying the dividc and conquer technique . (06 \tarks)
'Io
't-
b. Explain the divide and conquer technique. Give the lieneralalgorithm I)AndC(l'})lWhere I' is
c- 6- the problem to be solve] to illustrate this techniqu'r'. (04 Nlarks)
,JC U. Apply source removal method to obtain topological Sorl for the given graph in Irig.Q3(c).
.t 'Y'/
(06 NIarks)
!s
3c)
nr1
i* 1)

)\'..-.
ooc
c o{J

+ .L)
tr
Xt)
5s-
U
* c.i
C)
+J
c
z I.ig Q3tc) ,
Nfl
ll
. ,'
, ..'''
d
+-J
L<
c OR
-r
'.= a. L,xp lain the merge sort algorithm. llr"rstratc
I with an cxamp lc and givc thc \/ol'st casc
ieni'y 0 f merge-s011.
c fYic (0ft \Iarks)
b. ,4ppiy quicl< sort algorithm to the ftlllow'ing sct of'numbers"
55, 7A,75,90, g5' 60" 55, 50, 45" (08 l\1a rks )
I o{-3
l5cs43

Modul*ig i

a. Apply greedy method to obtain an ,;oiution to the knapsack problern given M - 60,
lpfimal
(wr, w2, w3, w4, ws) =- (5, 10, 20,30, 4tl) (['t, pz" pi, P,t, ps) : (30, 20, 100, 90, 160). Find the
total p rcl f lt earned. (04 Marks)
b lixplain Iluffman algorithm. With an';example show the construction of Huffman tree and
generate the l-lufThan codc using ihis tree. (06 Marks)
c. Apply l)rim's algorithm to obtain a minimum spanning tree for the given weighted
corrnectcd graph^ [Fig.Q51c)]. (06 Marks)

li

F ie Qs(c)

OR '

a. I :rp la in thc botto m up hcap c0nstruction algorithrn with an example. Givc ihe worst case

c f'flc icnc\' o {- th is algurithm. (08 N{arks)


b z\ppl)' ringie sclurcc shoriest path probiem assuniing veriex a as sourcc. fFi.efer Fig. Q6(b)]
. ,' (08 Marks)

I'is Q6(b)

/j
'W
a. Lrxp lain mu lt istage graph w ii ll an exam[ lle. Write multistage graph algorithm using
bacl<ward approach. (08 Marks)
b App ly It loyd's a lgorithrn to so ive all pair shortest path problem for the graph given below in
I'is Q7(b)
(08 Marks)

I"is Q7(b)
2 c>f 3
15CS43

w"q -, OR
a. fxplain Bellman Ford alio f ind s ing le source to a I destinations 1'or a
shortest lpAtli {iom I

directed graph with negativc edgc cost (Ott Marks)


b. Apply Warshall's algorithm to the cligraph givcn lrclow in Itig.Qtt(b) ancl fl nd thc trans it ivc
c [o sure "
(08 Marks)
Jl

,...-,:,r'.,r,
' Fie.Qti(b)

' '. ' Mod,rl"-s


a. Appl>l'backtracking method to solve subset-sum problem for the instance d ::: 3 0 ancl
'S: {5, 10,12,13, 15, l8}. Give allpossible solutions. (Ott N{ a rks )
tl;. '.E,rplain how travelling salesman problem can bc solvccl using branch and bouncl tcshn icluc.
(0ti l'l a rks )
(-
Define deterministic and non deterministic algorithnrs. (()? }l arks )

OR
10 a. What is Hamiltonian cycle? Explain the algorithrrr to find the Ilamiltonian'rycle in a given
connectecl graph. Write thc functions used fclr gcncrat ing nert vr)r't ox ancl for llnd ing
Hamilton ian cycles. (09 NIarks)
b. App ly the best-first branch-and-bound algorithm tp so lve thc ii'rsta1c1 o f the givcn job
assignment problem. I (07 }Iarks)

Job 1 Job2 Job3 Jo b4


ae 27 8) I)'erso n a
lo 43 ,l
1i Person b
ls 8I
6e
ril
4)
I
Perscl n c

[7 I'erso n d

:irrF*i<*

tl
3 of 3

You might also like