Quick Print – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
siteicon
Solved Problem Solved Problem#CPP#6043

Problem Statement - 03E

Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion.
P + ( Q – R ) * S / T

Solution

INFIX STACK POSTFIX
P P
+ + P
Q + PQ
+- PQ
R +- PQR
) + PQR-
* +* PQR-
S +* PQR-S
) + PQR-S*
/ +/ PQR-S*
T +/ PQR-S*T
) + PQR-S*T/
) PQR-S*T/+

OR

INFIX STACK POSTFIX
( (
P ( P
+ (+ P
( (+( PQ
(+(- PQ
R (+(- PQR
) (+ PQR-
* (+* PQR-
S (+* PQR-S
/ (+/ PQR-S*
T (+/ PQR-S*T
) PQR-S*T/+