<1>
infix notation ===> 2 + 3
(polish)prefix notation ===> + 2 3
(polish)postfix notation ===> 2 3 +
ex.
prefix and postfix notation requires no parenthese
ex.
prefix
-+7 * 3 5 4
postfix
7 3 5 * + 4 -
(( 3x + 5) - 8 z) - 9y /5
(((3*x) + 5) - (8*z)) - ((9*y)/5))
prefix - - + * 3 x 5 * 8 z / *9 y 5
postfix 3 x *5 + 8 z * - 9 y * 5 / -
<2> postfix notation:
3 x * 5 + 8 z * - 9 y * 5 / -
there is no need for operation stack because each operation is used when it is read
eq. //ref. 7-10 on p.334
<3> Infix to postfix :
how to translate infix expression to postfix expression
ie.
((( A + 7 ) * ( B / C )) - ( 2 * D ))
===> A 7 + B C / * 2 D * -
Idea :
move the operation to the location of crresponding
and remore all parenthesis.
eq.
===> 3 x * 5 + 8 z * - 9 y * 5 / -
how : use stack to store " ( " and operator
ex. ((( A + 7 ) * ( B / C ) ) - ( 2 * D ))
eac " ) " triggers on pop action on stack
2 * ( A - B ) + 3 + C