English

Convert the Following Infix Expression to Its Equivalent Postfix Expression. Showing the Stack Contents for Each Step of Conversion U * V + (W - Z)/X - Computer Science (C++)

Advertisements
Advertisements

Question

Convert the following Infix expression to its equivalent Postfix expression. showing the stack contents for each step of conversion

U * V + (W - Z)/X

Solution

Symbols Stock Expression
U   U
* * U
V * UV
+ + UV*
C +( UV*
W +C UV*w
- +(- UV*W
Z +(- UV*WZ
) + UV*WZ-
/ +/ UV*WZ-
X +/ UV*WZ-X
    UV*WZ-X/
    UV*WZ-X/+

Postfix expression : UV*WZ–X/+

shaalaa.com
  Is there an error in this question or solution?
2017-2018 (March) All India Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×