Binary Trees
Binary Trees
Binary Trees
T1 T2
2 3
B C G H
D I
E J
• Copies of binary trees: Two binary trees T and T’ are said to be copies if they
have similar structure and same content at the corresponding nodes.
TREE T
TREE T”
A A
B C B C
E
D E D
Binary tree
- *
a b c d
int data; 4 5 6 7
15 35
39
12
17 21
36 45
18
16
• There are three different algorithms for tree traversals, which differ in
the order in which the nodes are visited.
✔ Post-order algorithm
D E
A, B, D, C, E, F, G, H and I F
H I
B C
D E
B, D, A, E, H, G, I, F and C
G
H I
D E
D, B, H, I, G, F, E, C and A G
H I
K L