0% found this document useful (0 votes)
27 views

(BOSE) CS Mid Sem Notes

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

(BOSE) CS Mid Sem Notes

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

ALCORITHM ANALYSIS

2/0/2
Time Coplei Space Cowlei a

txpevimental Theor iheal

mot machime
mdependant
Kimean Seasehk

LSeareh (A, he) CoST (Time

1 1
t
2 tole isn mm A[J Eku cC2
3. do it4
C3
4iim Ren C
S. retwn true
CS
6 elae retion false C

sts w) Max(T(i)) E DP

age
aT PC)T(D
EDn

Best case B() =min ( TC) t

.. ov Re unean 3eoeh
example
Wevet case
best _cCos
t e + Cy+Cs
deme -t in ialle

TC) C+ 2 3n+ Cm 4 s *C
a+bm +
m Tn) n
Asyptoia Nota i IiA

T
f) c
3nt2 cn

3na+2 5
Caualwhan
f&) 5+2+2 5n+ 2nt 2
an
e m|}A
ogarithie polumomial exponential

(T)

No

t
d ALCORITHM
DATA STRUCTURE

-1
-
.+a a

Pri f) o (n") (3

) ++atia)
M1
No 24
h
(),9

+atat +am)) z aM*a-M


+ +an+a,

7
f ) o(
R
+a + a,

O + + +
,nam+

m m-1+

Bi ©
) OCa) 3
cCpeave towdt.)

C 1)
f) 10n ++
lOn lont

C) m

1 6)
.

3 1
-3n 4n
4 s
2 0o value

No 9

3 4 (.
etoke
m z4 Smallev

(whp
Bi 2
eeR
m"2 M
f) 5
V nzi
5 5n+2 2 5n

f) SQ)

MOTE F) e() G)oCI)


NOTE. ONe
f)-0()

Becau f ) -O
n

mot pesible fo
m(met
m d c)

Loesely unded
eC extra donditim

d )
Cannet Lovite (n) X
3)
Small o
JeeRely Jonebonded

)tee
f)- w)on d S(n
bu me-
f)-G) fen)
Dat g4etoe

Non Pimitae
P*mitve

92

0 Non imean

hs Knean tro () nean

)A)
Aa
Fimite eomtiquoua 2et: homea emeus elementS.

A , A Ag An A
A A], Ag A AA . AA-
Jeoer +T
Pe
C-oneauaa o element
FOTRAN 10 1 10 elemene
m e ima mau 1 0 - s ) +1)E 16 elemenis
A
lanuae

haye, nbeae axa A

200 202 20 206 208 210 212 214 216 2.18

locahen A [ E 200 +i
her e
/

(
ALGORITH MS
DATA STRUeTuRES AND
O , u n be
UxU 2 090Lau
A coleaiow o

LoeALi,i,) AL-9 l-U, 03


Co fnd addres oyf e lnow www.bar eleme
Preceedi i, i

loc (A j,1)- BA (i-D u +j-) u t

LeAik)- BA
+) 3 +-)U, +9°2J
n - dimensiono aay
A
colleeien o 20-me n-1 dmengiema v-oLa
A(A-, 1-0,1-V3, - U )
leALi,ia í)
BA
-)gvg,+ &-)U,U -U,+
#Sporae Matrix
...-9
3 4 S

1otaelements 24 3 ++S
5x I5

5x5moi

Size 15

BA
s
+(-) 4 (n-i ) +(-i1) +

nn-1)+ n -1) 3n-2 elementA

Tidiaganal matr i

m a9aug
#Poynomu al *ep egemtaiom

poumomial
-
aU deqre es ae
reg Qmt
? 2x + 3 + 1 +l0 t +5

But aboe
opproaeh i in opiient hen entatm deqvees ane
abgen ea 2 +5 hieh weuld waste a
4paee.

Pti toeficientnd xene nt in


adjacewt cella .
2+3+ 2
DATA STRUCTURE ALCORITHM
Pointer Acwau
Stoima
tudente m wpe Reiv e

students

poimte oa
emdima
oup delimte
ee ou ex cept loat

gtet aoup(i)
end eup ) -

>Disadyosntage
Sngertim Meuo eem ent3
l be ime cst
Stack
LIFOKast n yad
Fi-st Out

#Aitmahc Expresaiom
Inhx Ep.A+8 C
Preix+A+AB
Postx ABC 4
DATA STRUeTURES &ALCORITHM

# I Parti
Poat (,) (
Puak 'imto ataek and o t 4he end oS
em m eft to riqk, nd peal step3to 6
untill ataek. is
ep
pPYpevound i oumd 4Ren pu it in P.
Ren puah onto atack
is d af
Pevat ound HRen(grepeatedy pop the 2tatk
wieh hos lame ov iahev preeedenee hom
Puah a into 4Re ac.
G.3f nd em'
Repeate dly pop Re tack kk s ned
b)Remove

(A+ e/6)1 E)F


L AB+ -

(cD/Et) *F

AB+ cd/Et F
AB+CD/ETF*=
Can Staek
A
( A
AB
AB+
(- AB+

-C AB+

AB+C
C-CC AB+
D C-CC A8+CD
(- AB+CD
C-CT AB+CD/

E AB+CD/E

AB+CD/Ef
AB+CD/E1
- AB+CD/EAF
AB+Cb/ETF*

#Sueue

ingert delete

meue

pulh A

puan B3

Add
hen
2 Pimt Cgueue Full
3. el e
= vear +|

SCrear) item
Delee Q
rear o t 4R
pint uue ep
else
item (fo)
wotfromt + |
4 5
/31 )
SCam Smbel 3tae P
( 2

2
(
25
(4 25
25
(4 256

3
(4C 25 6
2563
(4C/t 2563
(4(/1 25634
(t 2.5634/
256341/s +
DATA STRUCTURES XALGORTTHM
#Prievity ueue

af e have au P°P he ue

3 2cpevale qteos dieon poio*i ties, And ls6 we


Ae maintain %e rond omd eav 2aA o Ahe qpeue.

weu e

# S i z eo a u u e

size= f + 1
ff
f=si 2etoi ize
f--i}
# Limked List
2vuet 3t sd
start Imt data, (x)b
Shue st* limk
NULL

Struct gt mede

B 2 node h nede +)mlloe (eizro?(uede))


h d a l a = item
Link
A h ünk = NvLL
Imgevt Citem)
Node Aptr*Stnt
2pt (Node a) mloa (size of (uode)) ;
ptr-dada - itenn
ifetat - NuLL) Re
stont-pt
pt i n e NULL
ptyimt stoort,
3t At Ptr

You might also like