Professional Documents
Culture Documents
Parenthesis-free notation
10↑6 10↑8
same precedence.
10↑2↑3=10↑8
10↑2↑3!=10↑6
INFIX NOTATION
In-Order traversal of
• OPERAND Expression Tree
A
EXAMPLES:
EXPRESSION TREE
Expression Tree from infix * 3
notation involves recursive
step of making root of
expression tree the
operator that is to be 2 5
solved (least precedence)
at last and left
operation(expression)
becomes left child(tree)
and vice versa. i.e.,
2*5-3
INORDER:A*B/C+E/F*G+K-X*Y
-
+ *
+ K X Y
/ PREORDER: -++/*ABC*/EFGK*+K
*
POSTORDER:AB*C/EF/G*+K+XY*-
* C / G
A B
E F
PREFIX NOTATION
Pre-Order traversal of
• OPERATOR Expression Tree
+
EXAMPLES:
A *
- H
* PREORDER: +A*-*BC*/D↑EFGH
*
POSTORDER:ABC*DEF↑/G*-H*+
B C / G
D ↑
E F
POSTFIX NOTATION
Post-Order traversal of
• OPERAND Expression Tree
A
EXAMPLES:
• OPERAND › ABC*DEF↑/G*-H*+
B › AB*C/EF/G*+K+XY*-
› ABCD↑↑+EFD/+*
• OPERATOR › pq^~p~q~v⇔
+
INORDER:((A+B↑C↑D)*(E+F/D)
+ *
A ↑
E /
PREORDER: *+A↑B ↑C D+E/FD
POSTORDER: ABCD↑↑+EFD/+*
B ↑
F D
C D
POSTFIX , PREFIX
TO INFIX
• Start Evaluating from
Left to Right in postfix
notation. Find operator
and insert operator
between the operands
till end.
• Start Evaluating from
Right to Left in postfix
notation. Find operator
and insert operator
between the operands
till end.
Thank you!