Sei sulla pagina 1di 3

# Department of Computer Sc.

and Engineering
Tutorial Sheet on DAA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Asymptotic notation
1 Give the proof of the theorem
If fn!"amn
m
# am\$1n
m\$1
# %%%%% # a1n#ao& then fn!"'n
m
!
2 Give the (efinition of )i* 'h notation& )i* +i*ma an( theta notation,
3 Give the )i* oh notation for the fun-tion \$7n5 # 5n2 #8, Give the - an( n0,
Stack, queue, Circular Q
1 Sho. value+ of front an( rear pointer+ ta/e value more than 0! of a -ir-ular 0ueue n"4! initiall1
empt1, 2o. appl1 operation+ a+ follo.+ on the +ame,
Delete& in+ert 345& in+ert 365& (elete& in+ert 375& in+ert 385& in+ert 395& (elete,
2 9hat i+ the appli-ation of the (ata +tru-ture 3-ir-ular 0ueue5,
Heap
1 9hat i+ a priorit1 0ueue: 9h1 i+ it name( +o:
2 In the al*o for ;A(<u+t5 .hi-h i+ u+e( to ma/e heap& the al*o rea(+ a+ follo.+=
<"2>i& item"a?i@
.hile <A"n (o
if <An an( a?<#1@Ba?<@ then <"<#1
if itemBa?<@then )rea/
%%%,
In line no, 3 1
+t
if +tatement!& .hat i+ the <u+tifi-ation of .ritin* <An& .hat i+ the harm if A i+
repla-e( )1 A":
3 9rite an appli-ation of heap& .here it i+ u+e( an( ho.,
4 9rite (o.n the 3in+ert5 al*orithm alon* relevant -omment+,
5 Derive an eCpre++ion for the time -ompleCit1 of 3in+ert5 an( 3a(<u+t5
6 Don+tru-t a heap u+in* a(<u+t al*orithm .ith the follo.in* (ata
67 45 \$9 21 17 78 85 12 69
Al+o +ho. at ever1 +tep .hat operation+ are performe( alon* .ith parameter+ pa++e( to the al*o,
7 Ee(o the a)ove u+in* in+ert al*o,
8 9hat i+ the (ifferen-e )et.een in+ert an( a(<u+t routine+:
9 9rite al*orithm for 3a(<u+t5 .ith line num)er+, Appl1 thi+ pro-e(ure on )inar1 tree .rite the line
num)er that i+ applie( at ever1 +tep! .ith a vie. to +ort the num)er+ u+in* heap+ort te-hni0ue,

Divide and Conquer
9hat i+ a )inar1 +ear-h tree 4ST!: 9hat i+ the time -ompleCit1 of +ear-h a 4ST )e+t& .or+t
-a+e!: 9hat i+ the time -ompleCit1 of an un+u--e++ful +ear-h: Fu+tif1 1our -omment, If there are
n (ata +tore( in a +/e.e( 4ST& .hat i+ the .or+t -a+e +ear-h time: 9hat i+ a )alan-e( tree:
In 30ui-/+ort5 a part of the al*o +ho.+=
repeat
<"<\$1
until a?<@A"pe
If the +1m)ol ;A"G i+ repla-e( )1 ;AG& .hat .ill happen: