You are on page 1of 7

PAGEN

Macus 2 Teee CCoa) DATE

&eetaverlal Qu Binau ree


Root Mode
Q re-0odev TYavesal A
-Orde Taavesal
(3) Post-o rdey TAaves a
letaid Ruttit
Keumive ve An-ordey Traveaal
Algorithm
Travese the ekt Sub ee ie Cal
1n-0 2d e»(lett-subree_
Visits vot
Taaveas e t uwgubree: Calu inoade
nshe- subre e 2
aewdeo de.
sp iRepaat2 stup2 4 whila TREE, -NULL
step2 s (NORDER CTREE LEFT)
3 Waits TREE DATA
4 INORDË ( TREE RIGHT)
5. END OF LOOP
6.END
A) Ingaeler
averta

g DBEAFCHG.

(D E
(H)
PAGE No.

DATE

tunchion fr inosder Jqveu a

void inorder ( stuc Dodo*P

P = NVLL)
inorderp-> Jelkchill);
paint zd"p data)
norelp ntchild)
ese

1eqfasporn in-0aelev eaveu alL fa ha


Ao uoia see
A

dnorcler Sequonce D CE B G FA T HT
PAGE No.

DATE //

,
(
Inorde Sequence
1 2 3 5 7 lo t
D B H E I AF_C JG K

03) Weute inordey sequnee collouoiug oee.


3
(48
(20 4 541

58)
13

dnovclo7 Taaves al.


2 13 14 1Is
12 3 4 2 10
6 1 s 20 2g 7532 31 4E So s45865
Please node, when you arAngg yaues
i n some oddereneduay,en the
numbe ae aao exla cd i a oadened
noy.LTheab0ve oee i erampl obino
de
PAGE No.

DATE

a e - 0 0 d e r Taavesal
a) Alarithm
VE the Root a
ubhee
Toavee h e leH
3 sqvesse l l e ieuk gubhree

Paeudloode
TREE=NOLL
Sup1 Repeat 2 to 4 oile
WRite TREE DATA
3 PREORDER(TREE LEPT)
4 PREORDER (TREE RIGHT
END OP LO0P
END

ea A

ae-oroley Taaveual
2 3 S
LALB D E
H
/PAGE No.
DATE

Wers unchisn fa se-odev Taveisal o


a ree.

void me0ddex (ucr nodo P


P NULL
pint d"_P>data
regaler (Pleltdud
eoacler (P Ait dild
else

n d Pre-ooder haveuol

Pre0ree,TbaveAa

(Nato) re oreler can be wed on e bedua kugar


eppreiion. Ihne eppeion that we qot is
a r i z _apreamon
PAGE No.

DATE

ost-62dea avemal 3
- Algooithm
aveue h e e t -subee
subree (B)
Tavese thes u k
3 Teavese the Rodt

Pseudocoole TREE =NULL


StupRepeat 2 to 4 oils
2 POSTORDER(REE LEFT)
3 PoSTORDER (TREE RIGHT
WRi TREE DATA
END OF LOoP
S END

2 3 45 2

TGn HDE 3|KT|FCA


unchion Aa postozcler Tpaveual
void postÖrdev (3kuct noda P)
LP!NULL)
PAGENo.
DATE
//
postordarP lehtwa
poskoodea(-p- n hehid)
einlf "d", P-data )
ele

e A
3 (e
O E) (G)4

6
1 2
| D E B G C A
- n qesbm giveu belouo uo post-arde?
raveasa_geuenee,

S6 13
(50
sE)

Posd-0add Travesal,
2 3 4,66 & 1 o 12 12 13 4 S
G15 1 22 2032 25|43558s 6o 5 ue 36

You might also like