Answer to Question #246002 in C++ for roe

Question #246002

Convert the follwoing expressio to postfix notation. Show the state of stack and expression after each step.

( ( 2 * ( 6 + 3 ) ) / ( 4 - 6 + 4 ) ) / 5

Note:

1)no code is required.


1
Expert's answer
2021-10-04T00:50:33-0400

Convert the follwoing expressio to postfix notation.

( ( 2 * ( 6 + 3 ) ) / ( 4 - 6 + 4 ) ) / 5

First we are going to start with ( 2 * ( 6 + 3 ) )

Step 1. We first see the first number 2 out put 2

Step 2. The first operator *, push it to the stack.

Step 3 We see the number 6, out put 6

26

Step 4 We see operator +, since the top operator in the stack, *, has higher priority we pop (+)

Step 5 We number 3, out put 3

263+

Step 6 We see operator /, since, because * is on the left of it, we pop *, and push /

263+*

second part ( 4 - 6 + 4 ) 

Step 7 We see first number 4 out put 4

4

Step 8 The first operator -, push it to the stack

Step 9 We see the number 6, out put 6

46

Step 10 We see operator +, since, because - is on the left of it, we pop -, and push +

46-

Step 11. We see number 4 out put 4

46-4

Step 12 Because the expression is ended, we pop all the operators in the stack

263+*46-4+/5/

Transform infix to postfix ( ( 2 * ( 6 + 3 ) ) / ( 4 - 6 + 4 ) ) / 5 = 263+*46-4+/5/



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS