i
I
'...
I
19 )c_:s n'1
Total Pages: 2
LBS INSTITUTE OF TECHNOLOGY FOil WOM f:N
Poojappura, Thlruvananthapuram, Kerala-695012
f
i Website: [Link]
Department of Computer Science and Engineering
Sixth Semester B Tech Degree First Series Examination, Marclt 2024
Programme: INFORMATION TECHNOLOGY
Course Code and Course Name: ITT 304 ALGORITHM ANALYSIS AND DESIGN
Duration: 1.5 Hrs Max Marks: 50
Qn. No I 2 3 4 5 6a 6b 7a 7b 8a 8b 9a 9b
co ',I I II II J I I I I n 11 If II
CL 2 3 2 2 2 3 3 3 2 3 3 3 3
Cogniti\lc l,cvcl: Remember (CL-I), Understand(CL-2), Apply(CL-3), Anolyzc(CL- 4), Evaluate(CL-5),Creat.e(CL-6)
I
t PART A
i· ' '
Answer ALL questions, each carries 4 marks. ·
List the properties of a good algorithm. (4)
Explain time complexity of an algorithm that prints from l to n. (4)
Write down the control abstraction algorithm for Divide and Conquer. (4)
Explain Divide and Conquer strategy with a suitable example. (4)
Differentiate between posterior and priori analysis of algorithm. (4)
(5 x 4 = 20 marks)
PARTB
Answer any ONE/ult question, carries 15 marks.
✓ Calculate time complexity of general matrix multiplication.
6 (7.5)
~ Solve: T(n) = 3T(n/4) + cn 2
using recurrence tree.
(7.5)
a)
Solve: T(n) = 2T(n/2) + en using either substitution or recurrence tree method.
7 (7.5)
b)
What is an asympt~tic notation? Give the different notations used to represent the (? . )
complexity of algorithms. 5
(1 x 15 =15 marks)
Page 1 of 2
l'[Link]
AnsH·er ony Ol\1£/ull q11l'Mi01t, ('Orrle.5 /J mark,.
8 ~ - Write a recursive al!IoritJ,111 for implementing hinary search from an arrar J n (?}
element!, using Oividc and Conquer method . Explain algorilhm with an ex ample.
"1' Explain straightforward algorithm for finding minimum and ma ximum fr orn ;in array of n ('>) l
elements.
9 a) \Vrite the algorithm for quick sort using Divide and Conquer strategy and analyze ia ('J)
tjme complexity.
b) Explajn Strasscn's matrix multiplication and analyze the time complex ity.
(Ix JS =15 marks)
\
\
Page 2 of 2
Reg Ko.: _£f,7J1~ 1 ~[Link] ' .i:t,r,c. ,J1{[,1 ,_1, P, ~
03fJt>fTTJ040S UO'S
APJ ABIJt:L f<ALA ,"tJ '[Link].',OLO<,JCAL (;~IVJ-',U~n v
Si it th Scmc, tcr 8 .Tc<.h Ocg rcc (R .~J h am in-1111,n M~y 2'124 (21; 19 1->d"t1~-r<,t;J
Conr~ Cruk f'rf 304
<.:ouDt ?'fame : ALGOJfffJ f ,\ f A.'~A f, YS JS A .' i f) D t:Sf<; S
~1a:t. Mar~: 100 Uaratir,n; 3 Jfown
PART A
A11swer oil questlon.f, each carry J mark,. .\ far1n ,
Ex pl ai n pscudocode conventions for writi ng an algorith m. (3 J
2 Explain aggrcgalc analy sis with (he help of lncrem<.-ntmg a Binary co un~- (:, J
.)/ You are given an unsorted list of n eJements and asked ro search ff'JT an eltrrlCT!! in '3,
the list. Which is better, linear search or binary search? Jus1ii)· your .imwer with a
_,;omparison on time complexities.
.K' Explain control abstraction of divide and conquer technique. (3 J
~ What is the principle of optimality? Give an c.-xamplc. f3 J
/ What are the characteristic s of a Dynamic Programming apprCYaCh? Explain. (3J
~ Differentiate between backtracking and branch and bo und tecbnjques, 13 J
Y Define Longest Common Subsequence Problem and state its application. Find al} (3J
the LCSs of the following two strings.
X=AGCAT.
Y=GAC.
9 Define Topological Sorting of a DAG. Perform Topological sorting on the foll owing (3 J
graph.
_ur' Explain following complexity Classes. (3)
(iV Class NP
(u1 NP Hard
(iit( NP Complete
Page lof 4
03 oolTT304052205
.P ART B
• firom eac/1 module, eacl, carries I 4 marks.
[Link]'er any o11e full quest,on
Module I
, l · .. ~ymi11otic notations. (6)
11 a) Exp am ..., h b t · I
.
· the nlgonthm
b) Wtite to, . · . Sort and anuJyse t e es case am worst-case
. . lnsctt1on (B)
compkxities of Insertion sort. . ' .
Show ti1c s tcPS 1·11 "''t-fonning
r
Insc11ion sort on the followmg airay.
45. 78,23,28,90. 7, 1~.67. 15,40
OR
11 a) · us1·ng recursive tree method.
SolYe the following recurrence equatton (lOJ
T(n)= T(n/3)+ T(2n/3)+n
✓.4..nalyse tile complexity of the following algorithm. (4)
int functionl(int n)
{
int i,j, k=O;
for(i=n/2; i<=n; i++)
for(j=2; j<=n; j=j*2)
k-k+n/2;
return k;
Module II
13 a) Write the algorithm for Quicks01t. Show the steps in solving the following list l8)
of elements using Quicksort.
23, 79,90, 14,56, 78,24,58,93,57
b) Derive best case and worst-case complexities of quick sort by writing and (6)
solving the relevant recurrences.
OR
14 /wrire the algorithm for Merge sort. Derive the recwTence equation of merge (9)
sort algorithm and solve it by using recursive tree method.
ef•oescribe recursive algorithm for finding minimum and ma'<imum from a set of (S)
nwnbers and explain with an example.
0300ITT30405220S
Modu le HI
of Prims Algor ithm_ t J-1 J
I 5 a) Wrjte and explai n Prim ' s aJ gorith m. Obtai n the cc,mp kxity
tree for the gh:·cn graph
Perfo nn Prime 's algori thm to find minim um spann ing
with startin g vertex as 2.
OR
Discu ss the Dynam ic progr ammi ng-ba sed (IUJ
16 a) Expla in 0/1 K napsa ck Probl em.
on to the follow ing 0 ·1
appro ach to solve 0/1 knaps ack proble m. Find the soluti
3, 4, 5, 9} and P = {3, 4,
Knaps ack proble m. Knaps ack capacity 20Kg, W = {2,
5, 8, 1O}.
Find oplimal sched ule (4J
.)>1,, Given job seque ncing with their profit and deadli nes.
with maximum profit
JI .J2 J3 J4 J5 .J6
Jubs
, ... ~ -·--·----·-
f ·-- - --
2 2 3 3 2
Dead lines
' -- ·-
, -·~- ---- ---·- - ---- ..
300 250 210 200 180 150
Profi ts
'l
1 .. _ _ _ _ _ ,. •• -----·--·
.
-----------
- ___, _________
____ _ -------- ··•- --- - - - -
Module JV
()OJ
17 a) What is IS-puzzle problem? How can it be solved ?
(4 )
b) Explain fixed tuple and variable tuple formulation.
OR
m and draw its state space (8)
18 ~ State N - queens ' problem Solve 4 queens' proble
tree.
(6)
W' Explain Control abstraction of backtracking.
Page Jof .S
0300ITT3040S220S
Moctolc V
19 a) Wri1t: Rnbin Karp P11t1crn Matchin p; ali•.orithin. and t1M1 l y~t' 1ft wm~te,:ify . r~,
Show the steps in matchi111,,\ the pa1tcrn P · 3 111 12 <,~ ·r
235902314\526739921 .
b) Explain graph colo11ring prnblctn. Write 11n ~ppwx1rn11t1<in 11l ~Mithrr'I fM V;iyh ( f. 1
colouring.
01{
20 a) Write and explain KMP algorithm for pattern rnt1tching. Sh<,w the ~tcp~ in 1;,, ,
matching the pattern P ""' ABCDABD Cln
T = ABCABCDABABCDABCDAl3DE.
b) Explain v~rtt:X cover problem. Write approximation algorithm for vi::rtex <.N11cr /~,
· ' .fof .,i