You are on page 1of 4

Ulysses Urich D.

Duran AI22

Data Structure and Algorithms

List the nodes of the binary tree found in the figure below in:

a. Preorder 29
b. Inorder
c. Postorder
92 15

16
7 6

2 3 9 87

8 1 7
75

A. Preorder (RLRi) – 29, 92, 7, 2, 8, 15, 16, 3, 1, 9, 75, 6, 87, 7

B. Inorder (LRRi) – 92, 7, 8, 2, 29, 1, 3, 16, 9, 75, 15, 7, 87, 6

C. Postorder (LRiR) – 8, 2, 7, 92, 1, 3, 75, 9, 16, 7, 87, 6, 15, 29


Find the Preorder, Inorder, and Postorder of these mathematical expression

1. B * S – I / T

Postfix Notation: BS*IT/-

/
*

B S I T

A. Preorder (RLRi) : -*BS/IT


B. Inorder (LRRi) : B*S-I/T
C. Postorder (LRiR) : BS*IT/-
2. N / O + V – E + M / B * E + R

Postfix Notation: NO/V+E-MB/E*+R+

*
-
E

+ E /

B
V
/ M

O
N

A. Preorder (RLRi) : ++-+/NOVE*/MBER


B. Inorder (LRRi) : N/O+V-E+M/B*E+R
C. Postorder (LRiR) : NO/V+E-MB/E*+R+
3. S + E + C / O / N * D

Postfix Notation: SE+CO/N/D*+

*
+
D

E
/
S
N

A. Preorder (RLRi) : ++SE*//COND


B. Inorder (LRRi) : S+E+C/O/N*D
C. Postorder (LRiR) : SE+CO/N/D*+

You might also like