Friday, 19 August 2016

Evaluation of Postfix Expression Example 4

Evaluation of Postfix Expression 

Example 2:

Evaluate the following Postfix Expression:   7532^*922^-/+64*+



Symb
Operand1
Operand2
Value
Operand Stack
7



7
5



7, 5
3



7, 5, 3
2



7, 5, 3, 2
^
3
2
9
7, 5, 9
*
5
9
45
7, 45
9



7, 45, 9
2



7, 45, 9, 2
2



7, 45, 9, 2, 2
^
2
2
4
7, 45, 9, 4
-
9
4
5
7, 45, 5
/
45
5
9
7, 9
+
7
9
16
16
6



16, 6
4



16, 6, 4
*
6
4
24
16, 24
+
16
24
40
40 (Result)

No comments:

Post a Comment