Convert the following infix expression into postfix using a

Convert the following infix expression into postfix using a stack. Show the contents of the stack as the input is processed. (300 + 23) * (43 - 21)/(84 + 7). b) Also evaluate the postfix expression using the stack, show the stack also for each step.

Solution

SOLUTION:

S.NO EXPRESSION STACK OUTPUT
1. (300+23)*(43-21)/(84+7)
2. (300+23)*(43-21)/(84+7) (
3. (300+23)*(43-21)/(84+7) ( 300
4. (300+23)*(43-21)/(84+7) (+ 300
5. (300+23)*(43-21)/(84+7) ( + 300 23
6. (300+23)*(43-21)/(84+7) ( 300 23 +
7.    (300+23)*(43-21)/(84+7) 300 23 +
8. (300+23)*(43-21)/(84+7) * 300 23 +
9. (300+23)*(43-21)/(84+7) * ( 300 23 +
10. (300+23)*(43-21)/(84+7) * ( 300 23 + 43
11. (300+23)*(43-21)/(84+7) * ( - 300 23 + 43
12. (300+23)*(43-21)/(84+7) * ( - 300 23 + 43 21
13. (300+23)*(43-21)/(84+7) * ( 300 23 + 43 21 -
14. (300+23)*(43-21)/(84+7) * 300 23 + 43 21 -
15. (300+23)*(43-21)/(84+7) 300 23 + 43 21 - *
16. (300+23)*(43-21)/(84+7) / 300 23 + 43 21 - *
17. (300+23)*(43-21)/(84+7) / ( 300 23 + 43 21 - *
18. (300+23)*(43-21)/(84+7) / ( 300 23 + 43 21 - * 84
19. (300+23)*(43-21)/(84+7) / ( + 300 23 + 43 21 - * 84
20 (300+23)*(43-21)/(84+7) / ( + 300 23 + 43 21 - * 84 7
21. (300+23)*(43-21)/(84+7) / ( 300 23 + 43 21 - * 84 7 +
22. (300+23)*(43-21)/(84+7) / 300 23 + 43 21 - * 84 7 +
23. (300+23)*(43-21)/(84+7) 300 23 + 43 21 - * 84 7 + /
 Convert the following infix expression into postfix using a stack. Show the contents of the stack as the input is processed. (300 + 23) * (43 - 21)/(84 + 7). b

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site