Professional Documents
Culture Documents
n re9
rop,ie elomeutpe n othhid vne
Fav veryStubtre, dee abornant at the e2ot
hesmallosit areona aelonauis in u
HHo tpresa,tton a
hean (or any eP
Patnode : CoJ V nteger disn
Pa
aren node at ACi]:
Left chilLA r d e at Ali]: A2tiJ
Right child de at AlJ :
A( 2it2j.
( the rerrs
2¬+ 3-
(6 eemen in chile
12252S)+2 is less than o
6 t a l pathek
S
P chaat the au-ot
nthetre
ORT
Jhan
When weree q glement, edo
ieplonewt mtoiet
west er chld nede thx p
wth the.
chldren nd su it wth dhe
Cme o maintain unsqns_(nrep
eke ossibter
grtaler7 repeat
etocesS tl
hs
get ananohap
roahly be O(loqn)
2/o3/a Surale nkereen wost ase -O[ leqn).
nale
Ingneral, o(h°heihi
move than haf the olegnents
C/t e u e neoc (logn eahorlag.
Boo node n Beto takes2l).
Opamtns o Insartng 'n
olemanst ruildl un 4he heanlteth
ma min he
adegt
BOtLD-muN-HEAP A).
haae8ige: sheA)
for ftoor heapsza/2_darraLal
MoN-HEAPFy LA,J
end o
ED
QNHEAPIFY A, i):
lestehil4KAl2t]
ACAC:J>vnin Chid)
S a ACI, A Cminlnder)
MIN-HÉAPIFY LA min lndoe)
Bter vesion
N-HEAeF (A,i)
Lefe
C2i+ lnA))
ndclit1, Lef Child = AC2i+1], miChih: ltChila
righ inrda lotLrsa
2it 2 ralh)
HhtChild=AC24 2], rghtL,der= lzt2
traht Child t LfeChid)
manChild kght Chitd
minl bdoz
Trdos= 2&oht Tdee-)
elun
CAC)2 min Child)
Swep ACIAininTrda])
Mw-HEAPLE 1:0,hialrder)
aND