Professional Documents
Culture Documents
col" " are
fs stostug Nnolesx b we
«het in “4 nolex 7 Q unis
le Srbrag- 2. aero eiewting index < cof ™
Shang trader, we adel the diflrence.) I LT Mm, comoSauce AMF where eries
Jedemenrs \salos main
2 3 ‘
.em
Vee os S\N oe i
alo 98 aay Vow yp Brow | 2
3\8 e ot
x, add Casq) Rm
a os, add Cosg), REO
Rows wih Sietunin fended cow 3, Toro) ele 10
re \- 5 2 rows he befor Ase mF = a name
(er 5ele 24 = 4-3 GD add (4 4)
= | clements
a
umm in RMO xn
add £2
> Qed co
# index Ye, a
n anes
DV tend}
we (N14) a oo.
wel co] enmes Cn) Wirbta ie ae
oe y ts abreody
~ - [pecn-i+) | dlewen! - |
w= Ci?) L pled aij
G0
povks any when 1S) ebacts fom sand sober)
po wey fled - =i [2n-G-2] + Y-0
((-Dos ~ C299 4 cj -1)
MF. = Terod ele mw tba) aS
. * Eis le leg o S 33,» we = he, B A= 1000.
me ado orm ne
Here both Nn deaes
gdect fom Save.
adt CAo, a)add CA,
Rowe Ened « Sy, sow 0, owes
ae
See ees
ole pens) Total we +h
eqn Rb 221092 47F boyy
addv.(h,,) 2 1000 F474 = WTA,
P YD yews
yee a
Qa sew SN Qs .
Ru —5e9
nats gs
RSsxeS ada Ca . pala Oe Oa}
wie Gg) Oo | Oey | Ost]
Life Bas 4 © Ost, Dye)
Te Fla 3,4 Wo 8 6 an dace,
© 0 0 ax
e142 £34 42] Oelerrn FLO
SA Eqvare mode ye
on yo err Are, Blo, >
=) Aegemal Syst oll cov :
j je ie ey
3 Be
abet rosin dingoan} foe ~
AEN
Tecciegpeel main
DD Jwr Velo
enum A wal
fh & dlewents on Aer eck
# inlesh om my 2 oe :
|? une es few
remalaln vows =Cn-2)\o KT pele,
aca ¢ Ba ~)
moON bh
Within + YOO,
Aft ve fore
Mee (- ¥N
= Delewets
Total ele = 242-10
Gene voleze
lt AA
PN-N - Mi dinged, RMmo,
Res BMed
elreil
= Cin vows
, an ea aie) ACT
cs}? :
aces: acd Aliades Jo element
AL} <1" en wast cor
k “Te Compleriyy = >. f arefoes Soe Tod
2
Delete leak clement aa weak edt
! LN No proble oy be} 4 ete }
az n-\; 77
Sop (At] Ale J) Ge frled lary] a ele Oe
stoap CAD, ACAI) Se ete TS
Swop CAC, ATs) (ee [solsel 01% Jie] eel
a
eo 1 2
Ine 2
Ss. ote : “3 ;
a) oP, eemaks Ale posite ic. Heee @ emenes
WES peseah cg
REET Se We neeate J _3_sweps
Re 0 cements VQ n/a
Fal
|
be sep (Ans AGI) itfsoc
© 3
1
Gdet £, Cis,
i< 2 ite)
Swa.
PCAC, A Co-i-17)5
‘ wverse. Cint cw DJ, tak lew, nr hyh)
~ Wh < nigh )
Werle Ele popped a
fee 2 , a vot Yet
1 Dieewhed CF fore
cme \jecn® > tad C ") wile false
Brow (3 )
2 Be ne B, 3 enon Vwcatink of whe loop ae proves,
it. fue ge, atm Werotink «
era ations,
in “the ened“wate ts fee al) \ Coad elemenks | 2 Jreratens are ref ea,
Zones |
n=) elements , 2 lee each.
2a)
UNA, n-2, ....3,2,) > \,0,n4,0-2 2.2.23,
__
is pesteo|
Gime, | mee ®t new
“wereten as irs
pret
. 2QH-\41
PQ size) Ouse reese me reer ee
0, nA, n-2, 3,2) nn, 8
fe ements, 2 lt” each,
\
20-2) +4
1 004,0-2, +. 3,2 aCe)
2 |<— To?
1
2Cn-2)+)
Al sized Que ——S Qo size Que.
2 To ecdnce He Quere sire Le. AP Deqverts ab\ the elements 19
reder fo ponte robe Aek f4) 58 end wh le \sop , We nee
qe Pe fom his tterarin Yn! sees:
~ DOH, 20s) +4
ve, ntl, 2Ca- 2+), UUn-s)F1,- ae
Sone 2. Cae) $92 t9-3 LE DeitHagae Qe -
yee 2 VATE ee Cn-D) +9 = We know, pent).
2 San (COD LP +n = Hort
=canrewrd grap?
Tree
a Undive cred, acyalics
Neo - eter Dis wed to hie hierarchic ete
10
seer / gpa Chuve esq
acizaheo 6) Rineg Heap
Tr in DEMS +
DB -Tree, Bt Tees
et each element tn hee,
wpeeented by a node.
Wd: Crick is a node
ome inkl below a rede.
yee
go ff 20 38 ht |b ren
Br nede \0
qs a cbnt 20, sree with beige a3
ant. Mede Vrrecdintely @ Rook Nede-" Dietingsi hable
le Powenk a Node |
‘ / Orly pode w/o or arent
go “7 mode wie ery P
zo is « pret “bh &,% {O is the reek node +
CTopmest mode)
B)\enk Wode Mode wo @nteenad Node + Node wie
§ onl ould at Neat chile, 2:9:10/205 5°
Biter, 520 Codes excepr Jerk neces)
..
Degree. of a node '
E ep
Degree oh code with ey
. 4 a
\s cepresents the re: A, cbileben Pioery
jo 2
30 > Ss
Pte oh a node * “.
yy te ae lenge oh pth fem pode "90" te te
Far dest fee code « roy 20° 4h
Heigh- a le node =O. Mr a SOF 2 ¢ae a ETE TTI
> he \ hen) =F + oro Chi, boy ta
6 Cy CQ tree eight BT. #97)
He) = |r max ( W, (39)
~ (ru = (Wen ef Edges Rem shy)
Ae
node Yo “the lonaech.
! seheighr A pees Neto sh vot ne NeaB. fe laeight ve
a tode.
S? Level/ Depth of at ‘
Vevel oP a made ye ts the length abe pad
From yeot nede to mode %.
Ne- of Edges from the root
Veal of ver onde = 0
Eo oWNede level is kk ) \erl A, ire ehild is fet).
cot Trex? level = Helin of tree R
OP) preteske GR ance! IP theres @ path fom node
Pot nace gq. pthen atl the nodes in athe path
other then qa eelled as ancestors of L-
SrS0,1D are ancestes oP 5D.
Jo hes ne ancester .
ao -\° 7 20,10 g@-30,10 5-3/0, 10
Bo -10 le ~2©;'0 BO-38,10 6H-3,28,10
|
™) descendem at a node | Aether ,
7 —> 20,10
Tis a deseendet f, 20
7 TN a to
AM nedes ne Nescunalats Hy 10. |e ie the fincester lh
7) Siolingy : NeDes with same
7, N@ are sibling 5
2, 3,60 —!
2130 need
Prevent. Rect Node ca net
have ee SIL ay ag
i— Ye dees Got ace
a Peeta All Nedes gr a
Clenceatt pesHeular Jew)
2
clan, 4 sant
oe .
ware ap ercde! Now BP descendents Sy a node € taehad
te ede irselE rae dh, eke BOP 6 TH
at size AD lene pede => 4 size dyno 22 DS
pies = debotdets 4 Cireee) chee abe pole a
=> 2t6t+)
Size of vcle 3-5 2 ° an
p\ sie FE anode = sine oh ive descended |
Birney See
.. m7 pede can hove at most 2-child.
rede a have O-chijd. Clea node)
OS (internal node_ |
2-8
te AP bingy wee, v0 ah cach level, there ‘re
frax oo. ah elements / nodes pPresenr is a
Tl Binoy Tree / Complete or Perce Riney Tre.
Max” no, of mocles at fecl“h” Ra BT is 27! Cheek by \edve a
les is by
Marr? oc. Y nedes posse na SOS Fee oF laghe
= f mex” + of,
b% Me Gate rn BT
2 =N-)
2 s7-1=6
kas
b
Tare) = reeporae. as
Vy oy F\qor2t-- bob C4. e)
aaa 2 oht
sath Shey
a \rier ne. “y nedes iw & bina tree oh heighr bh
l hee | Ray = be) Ale wd Las theighe enwdt” etects
From peso. oe a
fo Fe wea, ments. Sen poms
ee ae
FRI woke MOONEE bape
a pera )S
Root Sens te on = ma loc(aisedfeamere Wooo
pew Node? dada = rey j
(®) peo Nede > feft = nce; \ebs dovn Gide ROo-p
TM Sige
@) ® + vyebuen Rees
cod
Gul [wooden] nor
Fa)\ Bioaey Tree
Bil beng Tees © OR
fener © re 2 dilden)
Prag Aree =A pee la Which every
Awteenad poole Sas araatly ve chidyen
RoeT= malloc (sizesPstrucr obey)
| Bey i Brom Tee os i He
| Ss to aed bree’
Shact Node * Lefty
int datas
Src Nede ER;
}
Shock Node ROT
srt;
“Refer BT"
Trak or dy voles Pte dy land x2 FA wS Bia ales
= onal nods
Bach wa L xe +)
Node Ves 2 childs = 64\=7,
Boog Meet A wee in whieds cacy inteesal code ae ence]
Childe -
Tord ee nodes = No. cy trtend 6 & + eee)
ie nodes Each
ea =2r3 4) has 3 childs
~ Stic?
fe of nodes = Ne. BY \wernal nodes X Nodes because +)
® Tes FP Mee IN Y
fbd ds FE BrSt\ = lO, mea
Lek Tobe ae nor aly Internal moder ne Koay tee
LU
ered oodes = Os Et a es —
Nes) aw aan in Cet) Ye eal \
has k- childs
or & T+
4 sy leo nedes the Noten nodes - kore)
L + i cae
2
» Le &T-T 4+) - TG ott
am len nodles ,
- fC) °
Wert anew) :
eae kel
-)
Ke Nod, childs ech in
sep 1 Grn i
dey 2
h ie yece with 2) SF tege
OS leak nodes
pockes. Ay degree 2 ag
—)i— 1 a
,
Bind se 00. of Leal roder wot
ne 2+ 3rl>\
a TToral nosh nodes n= & = \ 4 Yoh
w+Le-+?
Nos oh bee meoles <3
bruteae Tenens
v
Ren, 480
7Wee condds oly!
yp Reo}
2 Nap
Root
> Qepth ovtler _
— Ret Ly Re Le
Ly, Boor Ry ercek weed
| XD Up Rp Re ae es
Poe wy ler tote
243,54 3,8 OR, bi, Rea Is Weeds re hale
3 YR, Rook, ey subree
as
ye Pre-order Troveredl > Rar Re,
MEseeee Trovtreel
DNVisit/Peint/ Process ‘The root node.
D Traverse. La ob rook node 30 pre-order,
a en
we
| bo 7 5)
Ray er kr cy © © C
j wes wh Sw 5 r@ere
CS i
Fart ABDECEGL
for fr Ry (8)
We
ogo Bey nade phy UM
amier Node Wied nes Ave'n wae
‘nw eta Pycerden
inter ede FRB | Tae oy wee Avery
% Te” Rag vist
aaa
|
|
| Smuce Node. be vicned AbnerRe oentec (Rooy )
s
Feorder Cosfauce Nate fhe)
5
x
UC er Le mun)
Ly PPO pre otarer,
> Reoeder C Pye Je Py);
DCP Right)
A? rehen ,
¥
Manske
[phere Ry) Ca ber” Lepr RN)
Wirvene Lp threat node ta To'-ordes
2 Prat Nii/Prowes Yost sede.
D Terese Ry A, rook mak iq Tr-oveler
\Sroder to Tio 4) reedde i)
Ns ait) you a
Sir
nnd (sham Nede Pre)
*r) §
Vlwurder (Pir olefy);
PLAT pwadem),
Words (Pre 9 digit)
\iJ
|
|
bla
PM: DBEAEGS.
BE Pooka soder reverand
D Troverse Lt d peep node tA
Cr 8, Set)
1
Prot -srder.
— Ri
SPP OAKS / process rect node.
CPost-eedler 32 on
aa ite thived
. AM = =
Veil Tecteder (arc nude & fe
q
fF cee) £
» fastorder C Pr le
2 we 0 Pan
Nt
eV
R:| Ne. ef ualalsclled Vinny chees wih © nedes =
(Cohape Jab erne /Gtamerry)
For each wolibcled smeenre => 0b oie agg nbd,
2 Lebelled blncrey trees
Nit 2. ;
_ % nedes ieee trees with n modes
lo. OF Laboelled navy trees with a modes - —te
n
= No shuctares/ unlabelled x 0)
x9)
| DeNe of Hany eee soit preaceer! ABC
Aas! No. dy shathures posethle = 2a re N=8
Pp A, Baie gigs =o) Vere n=
pele moe aA ne\ °
Lobel’ sais mie ABC | Ney bin oe
| Ga, Nae fe + 7 4
| Wih a at 6 °C
en \o/ rel Baterdey lenges), ne. ab BT sacilele = "En ce
et ees pescible wie pre ABC O oar) OR AR
BT. with Pea ABC
[R
R a fy, By
‘s myo
Fostic0e tereoa a ee oN
etre ODUM Bre i
bes Pe ABC
|os BAC e
pee * Bac
en Yat woegueo pester a posorder ee
Pre-order 9 Ln-odler =?
post-ovdec Ain -order 4
wh a en pew del n-urder no. dh, BOTS = Atmos 4
eet
Ben Car
SABDENCGIT ~ eiBOE Cal
fre te 4 ict J
LORE mC 1TGT = ey
0 No
ane . C ReG TI
shan ie! e Qi E43
gTenacee 9 po ow ; Er Ky
ye yook in )aerden Re pect
Ore SY aaa _
eae PEN C AIT wp Blby Maz95
e 5 & a
z oe
oO ut Ry 1
piDBE A GPG “Tyger
ma DEBS PCA jo: 0l8 tet
me DEP GT pores jot GELB SC
Shar arth ter Go ICT
pTeaesse” post —wcde or Pf
eaten <— \a. ge x
Po QF
Deep crndichas, Sot nedes 19
imader 9 veep HAA
Jy ch \ea/ yest rode
ASS \o:
€ \ °
nek h 2 \ AY
} poe a0.
eR i ; : ok
2 (ob <@¢2"=| aa
aby Pp ede
ho
Ip stricture of a c@T with | node
>
Wry
enioF 7-5 nodes 4
BA ye ts 2
2-\
. : h <2")
a a ; : att nt cas
tag 2" leq loginry-1°< WK jg. , eq (bt) Kbrduleg2
hlegu § leq n Min? Ne 5 Con water? ga
h< lege te Dysiey 2
a Vie Cieg, 0) J Stee >. log. Cnt)
ThSlagca owt mat ape, WH) > lega(nr!)
pane nedes Vhs loqacnt))
Binary Search “Weees '
atiefles he peopti7!
smaller Jha %,
gare 1
fA BST Ss a BOT thes
AN te leeys in ake Ly of a eden) on
—
en
ae
Clim eny redt_in BsrD
Conéhuck BST by insecring
Fal Keys jy samt ovcler!
be2aasy *
\o,&, 2,2, 3,%
J
Fe O.4°% x g
ypot ets sheen losertion over oP Yeys ie Jen = 4. 4
pcr BST by \nsextng Foye 10,20, 20,
yecetio escles can be
4, 201 2° 2e,1O,$° By, 10, 20 ae keys Boo BsT-s
yo, 8028 20, 20,10 0, 26, \0
ae lo oder drnereal ofa By is choays Toomig oder of
geyser Given Abe keys Pf a BST, Inoder deaencal can ee
ye \n coder ww Reed for any BST.
ate Quen a precerder nevessad oR a BST, We OO Sind the Inovder
a we Mined For ang BST Caio ineeasing oder). “Thy ss
we Knew wh a ajven 4 pre-encter 8 Inevdler, we can consect
2 gst one shen vc . postecer Jia ere can lee ad 420.
@ Quen a BT soRcruce ith a nodes oo keys,
Rests one possible Z \o, 25 5.7.3
pot) est with o xeys = 2
Spe sp SOS a ster
-b- Search la a BST geanch 7
peers Se
: _ Fe comprcisens
& dewsts rhe
or) grep
yO z= Re
pes dhanps hale OCW) he oC'995
& CR
65
bode
IQA OB
Bkewed eee
hen= . :
| Tew _Compleriy
Fern wks, tok Se OCs). ‘19 the weet
ee Aree ie chewed (ie. Uo baton
Grint ro duct . '
n tafe gprberwise, TC of e.9)
Me info — =
% sofa?
nie: n/a
4 4eleven of a nade hewn O-child Cteo® rode)
Ly. Lt uw
2 R .
mA RK aN
Gee Ti We ned ve denny Ake parent
peekr Ceh nade fo be Aeleted) whch a
\s ren he to \ Sy ee palate
is permtiny te ede ve Acleted Poe Dew P
= Malee this eamiec WLLL
(Pe > dara < Par 2 data) else L
0 pers lef = roe Pars righk = NULL;
Seep) / yirseter
Core T! Daetwy oho nade having one child,
in Oday K,Ryy
~~
&
Tr doeily wre Gonenk pre [ey &,
Cay cede be delered) aids —
pore te vole te be de\ercal, Mate thie pointer psor te
: pede jo be delered,
Wc
an wih [afr or sigh aey
é old « ,
the obs) ob
Coce Wt Ortekin YX node wr wo Aidrew-
‘\ pelerivn of Jo.
¢g . (ne eat." Reg
vols the
< ° Subree of F
i\o Enawtiney ge wlemen
of nmbly upda
We pexte Ao be
abe
pede i
ode 2 rm
ang a t \ ' 5
JZ (Merhod 2! Replace abe on \
= Tah tte erratlest oade 9 2
a2) aularer, ol, He node Q #2 foee aleletieg
fA 8 cose hoy a0 Aemenr/nede VO WE We
c soo yet oh he nesds updsed wo Ab
ue daleied with He .
5
7 Recon Aaa 1s smlar toao Bae cal “ee
cpMat node in NS es hal node -
Ry node othe wise
petocrn delerion
wih ene child.
Y Been deletion Ay nrede wito two cl chrer pan be reduced to
delle) Wir etter ont oF 178 child ren
\f we Mode te \ee sepla ued has a chad, en Bm ele
Bice oe, cla» CA node fo be replaced 37 Ly Cannot bene 2
a5 We ark replacing Ht beagest to Zp)s
G7...
Note! A pode te be ceplaced bn the argh abet cennot be
per? tuo childen 7S Wwe we sepla ding! phe amalles}— wate
withthe node po he deleted, |f tk has bof rede ag well,
SD thot becomes te _ornlect pode do be replaced.y DMA
i, AVE hee, eres
ot Saad ate Ke
< Vo abe ey
easVie
“b Rp >
EAL TE Prepay The tacban
yw 0,4. OHA fiero aP Ronade eo Mien Let”
de baghr eV WS NePe subbtee Ve belghe Qe cai, ciqht subbete
cor Ahodd be
Mot Man Ot,
MY / vroleoee
joreneser dhe
Aperations colle + AVL
relations &
BsTs.
Fiance d vain
NL ees Tare 6 pelght Vabanciny
bed, Gachat of come rode
nyse Hae
jpeerrion af keys mn
piece ren Oot), Viee becomes rollaccte we
Lp net Ry te : jalan 2
sYeserivg, 025,50. fn same Mendens Ao. ° Viclgtee to ED
<20 E> <
() waa} $8
RS wees
a eh)
seers $2
0,5 Pau
c 57
u 2
e 6
FConstwer AVL hee by imsecting Keys Mm gwen oveler.
3,\57 22,46," 38 S
(50)
Fiel to
jalate,
5, 20,60, \,
\
bily Inset 2 Now, ae
i one \nser ayPRI rdotien
aw @ ce % ol ay
@ :
1 (© Ge
8 { ©
1
LL Revealing] et pale . A
a we welation if Retin | Seat oo
=
Max” pevoh pades Va an MVE ieee oP wate h ohh
: g TI
PPV oo. a nodes in °
hee o seh FY. hen ge pyie foe
wlid opens. “
vs
2 7 vet =)
@) ~
| . a ' “ + D t pee be the atin. ne
, T a ob q oedes in an AVLS See
ME AE Hy ph ea Be to
SS
ACH 9 Ch) 4n Cha) ath) = nh!) ah -29 +] _
Ch) = 1+ neha enth- 2)
Qik BT. Whee the MAL bis ake 0, oP
cedex in Ry de armect 4 Yr each ade, find ave
nodes tn such a tee, & weighs
a :
in ly doe
; ob
\ r an gn ce valid OCH) = tEM
y \ cae ; veh * nCn-1) -f
aan n(n) =A ator OF
pe ter tt W
Lnthdavy ha nCn-Vod on)
2. eee _ ne)
\n&@- 2alh-) i :
= nts)e 2 = 32Be
r oh le het th Rp is akmost 2
a pee & codes in uch a BT dhe 4
: Q <— woud ye tho Feat
eA Cheek Gene mi
\ \y fy os Rr ah b
contain \eask
nth) = \4 aCh-l) + nh -3)
x ee \nsenton 2 Iroorr using BET procras
Upedte THe Veit Grom new nade to the raot ie. Beboace Factor
Joie Ly imbdedance, iP ilodanced, balanee te Unio re
EC5>)
\nsect > Const. number of yolation ,
AML eee, Walden oll ode.
Delere 2 Cre looalance )
Subsequent! perRem delenon of 2 -
“Now, here Balance taeter
becomes -2. -.
to vidlake the 8-F
ja the
oer Been
We con vephee i voltlo the
Nest pede ay Me Y
Soles aaa
Belere M4
ake rede be be
sw Shinever |/Ne Aefere ol.
is w he Added,
22) Arlee ef veplace
with We 4
inorder Succ eFH1,
eck
puledin en peepegale
Lets Smear All abt
fe node «
g a Qelerien > (7 C4 1) ane Oh getars
she wevéh cases