Evaluation of Postfix Expression
Example 2:
Evaluate the following Postfix Expression: 42$3*3-84/11+/+
Symb
|
Operand1
|
Operand2
|
Value
|
Operand
Stack
|
4
|
|
|
|
4
|
2
|
|
|
|
4, 2
|
$
|
4
|
2
|
16
|
16
|
3
|
|
|
|
16, 3
|
*
|
16
|
3
|
48
|
48
|
3
|
|
|
|
48, 3
|
-
|
48
|
3
|
45
|
45
|
8
|
|
|
|
45, 8
|
4
|
|
|
|
45, 8, 4
|
/
|
8
|
4
|
2
|
45, 2
|
1
|
|
|
|
45, 2, 1
|
1
|
|
|
|
45, 2, 1, 1
|
+
|
1
|
1
|
2
|
45, 2, 2
|
/
|
2
|
1
|
1
|
45, 1
|
+
|
45
|
1
|
46
|
46 (Result)
|