Convert Infix Expression to Postfix Expression: (A/(B+C)*D-E)
Convert the following infix expression to its equivalent postfix expression to its equivalent postfix expression, showing the stack contents for each step of conversions.
(A/(B+C)*D-E)
Symbol
|
Stack
|
Expression
|
(
|
(
|
-
|
A
|
(
|
A
|
/
|
(/
|
A
|
(
|
(/(
|
A
|
B
|
(/(
|
AB
|
+
|
(/(+
|
AB
|
C
|
(/(+
|
ABC
|
)
|
(/
|
ABC+
|
*
|
(*
|
ABC+/
|
D
|
(*
|
ABC+/D
|
-
|
(-
|
ABC+/DE*
|
E
|
(-
|
ABC+/D*E-
|
)
|
|
ABC+/D*E-
|
So the postfix expression is
ABC+/D*E-
No comments
Post your comments