Professional Documents
Culture Documents
Adobe Scan 16-Feb-2023 (1) (1)
Adobe Scan 16-Feb-2023 (1) (1)
Pmoted malysis
in amoiized analysis
averoge the Hme rqwf o
, We
Porform a Saq uence of d ata shucture opeUT ations oves al
the Operahens perfoTmed
imo ied analysis helps to shew hat the qve ost
OF an
0peratiom is Sma ? we average ove a seq
of
uene
operations even though a
Single oerahorn wthin the
aquence mignt to expensive
moT zed analysís is diferent hdn
dverane-Caje analy sis
Amo yi 2 analssis quanantes ha averaqe fes foi mu n e df
each 0erasion in the wTSt Coße.
ft has three most Commm techniq neo
ensve
Stack if
he
pops
operasion w i not
thon objects nor
thon Mlipop operasion
> i f k is
not Aosit
in stack,
8
mako Ony Chono
code
Consider the bllowng pseudo
muUTT POP (S, E)
k>o
(s) and
not STACk-EMPTY
16 whle
2 POP S)
3 k-L
Exampl
14 Ater mvLTD PoPCS, 4)
06
39 Af
moLI P ,7)
(S
a Statk o 5 objecs.?
MULTDAP (S,) o
Tunn hme of
of p
ineo in the numbes
time is
achua Funnin
Oeradhern ochually ketuled absruct casts of
of +ha
in tems
hus MULTIPoP is onolyzecl
& PoP
1 toch ar PusH lo0p is the
of itratons of the whi
>he Num bel off +he Stack.
in CS df objects Poped
Oumbe
, ach teration 0f tho loge make me cal to POP
The tota cost o MOLTIAOe 1s mn (S,E) and actual
Tunnng Hme s o lintas function o thls cost
o r Sequerne of n AusH, PoP and mULTT POP opratirs
m an
folHally empty Stuck.
have
On oCD
A CCOuning metho d
weaasig
we n difemng changeo to difeent peniaioms
opersaiems
Some
Operautims chargeol moe ess than tha
ac hually CoST
the amount chargad lor an operaiovm is
Omi2es cost
when
when Operaiep's amrtized cos exceeds acdua! et
we asign th dHerenre to spec h object in the
datu smuchure edi+