Q. Execute your algorithm to convert the infix expression to the post fix expression with the given infix expression as input
Q = [(A + B)/(C + D) ↑ (E / F)]+ (G + H)/ I
Ans:
The given infix expression is as follows:-
Q = [(A + B) / (C + D) ^ (E + F)] + (G + H) / I
Symb Stack Postfix Notation
[ [
( [ (
A [ ( A
+
|
[ ( +
|
|
B
|
[ ( +
|
AB
|
)
|
[
|
AB+
|
/
|
[ /
|
|
(
|
[ / (
|
|
C
|
[ / (
|
AB+C
|
+
|
[ / ( +
|
|
D
|
[ / ( +
|
AB+CD
|
)
|
[ /
|
AB+CD+
|
^
|
[ / ^
|
|
(
|
[ / ^ (
|
|
E
|
[ / ^ (
|
AB+CD+
|
/
|
[ / ^ ( /
|
AB+CD+
|
F
|
[ / ^
|
AB+CD+/
|
]
|
EMPTY
|
AB+CD+EF/^/
|
+
|
+
|
|
(
|
+ (
|
|
G
|
+ (
|
AB+CD+EF/^/G
|
+
|
+ ( +
|
|
H
|
+ ( +
|
AB+CD+EF/^/GH
|
)
|
+
|
AB+CD+EF/^/GH+
|
/
|
+ /
|
AB+CD+EF/^/GH+
|
I
|
+ /
|
AB+CD+EF/^/GH+I
|
POSTFIX is:- AB+CD+EF/^/GH+I/+