A * B ^ C + D becomes A B C ^ * D +
Here both the exponentiation and the multiplication must be done before the addition.
|
current symbol
|
operator stack
|
postfix string
|
|
|
|
|
1
|
A
|
|
A
|
2
|
*
|
*
|
A
|
3
|
B
|
*
|
A B
|
4
|
^
|
* ^
|
A B
|
5
|
C
|
* ^
|
A B C
|
6
|
+
|
+
|
A B C ^ *
|
7
|
D
|
+
|
A B C ^ * D
|
8
|
|
|
A B C ^ * D +
|
in 4 line here precedence of * greater than ^ therefore * should be popped out , i checked precedence table too , someone explain this thanks