Professional Documents
Culture Documents
Gate Cse Notes: Joyoshish Saha
Gate Cse Notes: Joyoshish Saha
by
Joyoshish Saha
h, , h7)*eri, n o4c< 1 ,
n=
-2d
C
c>2, e c>1, m! , 2
, m', n
NoHe
, n>i
Asymtotio NotatHon
Analo ot
tarws slower tham any ol40)
m ti ple of
3 roVT atar 4han
done
Cgtm) uulthpla ot
ame 7ae ot
) 0G)
1-cER' t c eeR l c e R
m- ) n-o ) n
4)-o (g»)
4 ()
n) ()
gm) 3) (10)
(f
man
)- 0(49*a)|0)- b
n ) - 0(j*)) z ) o(h(»)) )= o (h).4 04 also
-
(maCt z))|
a a
)k
a-i
P+1
0)a och), thom - o (). It i thur (or both) bi-oh
As aüttle-oh. then fh)
, (Smal arc fr 2 , )
HHe
90).Jany any
ove
bu
mot+ bot) the 8 is eplacad by anothuu natathon,
notatioy.
thon tha cowclu'ou uses (the veplacad
that xame( on)
f o(h)
but
xtended Maste's
aT(%)+
T)- e
(»*') a91b>iik>o
Teatnumberu
.9a , T() -e (n)
e.3 a -b , 3 t 7-, Tn) e (n J»* n)
) - (n J» lala) T()
i)f - , T (Cn)8
) (n *)
3. a , ) >o, TC) (n*l2*»)
i) fpo, T(») O(6)
Moster's dor 4ubtroaet conaer T ) = aT (n-b) + o(mk)
be
pas enthes itatioms CR-1 mi, j1
m nmn # Scalor muipicatton needed campute mmatri A .
TC o0n)| st
,jl
mam
mm [iin]
#unaue ubpod blaw possi oie
h+ (n-1) + 4 n(n
2
+1)
cize Ciee 2 s2en
. Lovgest Common ssubsequuna (Boute tora d (n2)
i 0 0r
DP lcs C)
TC o (nm +Ies(!, j-4)
SC o nm manAcs (i-1,1), j70 ; 7 j
les (i,))
3. Shortest potw An muHistage aap
Gaph.
Veris þavitioned
Amto V;'s. 14iik
s+() mu CCj.1) + togt(1#1,2)
edge (u,v) s.t
LEV
in Vi
Verten j,4) eE
to verdex 4
T
i i 3 4 V;
A.
A. Binary Kafkack PsRudo-palynamial -hme)
amd max
peito he a.
(K)
Ployd-Nay shall (APSP) be he Nelah+ of a
t
(1 K 0 shoadest ba-h 3om to j
aa
hech oll imoo nediaBe verticas
d (K-1)
in the 4et 1,2, .
TC o Cv') SC matric
o n))
u i ng hem
s0uCL to n path
ghortestF
d(,i) be tha lth
atmos
hsse lavgth
- 0 =
S d (o, 4-),
TC e(vE) Dthurwis
m i n d (u, i-1) + ( u , ) J
ev u,v)e E
# BFS Dijksta's Pbemam-fovd loyd-Warshall
aph o(ve) oVE
rHena
Mar tae V,E 10M V,E 300K VE 10M V 400
-V whshE|NA
gma WA Overkill B
aph hela h d
im coeet
Sorting_alaos logic
. uick sor: Choose påvot elamont4 place
ier o o olems,
elems,
wwtinue until Lach dubpnblem A
o ston 4t cach subprobRew 4
Divtett 2 caua ats, recurively
a. Mavau 40Tt delete
sorted st 3, Heop 40tBuild max hoap,
Smeto ngle 4. Bubbla 407 Compare t
ere Laapoition (rpeat
m-i fims),
a x pace n-Lases, 5. Celecfion 4srt : fimd pos"
adhacentt elom,nepeat
crchange adacen with aR whore 1,2,.. , n - i pases
and
=
mon elem om
a[i..n) swap
aTI to a[J
9msert a Lit1 Amto cormLot otton
mto
6 . S n e r t o n dOrt
aTay,
Whore i 1,2,.., n- paSses
gsDrted part
w°rs+ case,
1. Snserton Aor(e(n')
#tomb ais owaor Aovfma alos vorscae),
Ou5F ordor 2. Meg 40r C O(nlg)
K
OCKn)f H07st
wo7s+ cone).4 uck o7 ( o(n)
3. Heap 4oat (Olnlgn)
averae)
AA
poynomicelly bownd zd E o Clg)
- Cn
2n
olabeled Bmary pees mmodes m41 - Cn