1. Polish :
Step 1 : Push "(" onto STACK , and add ")" to the end of Q.
Step 2 : Scan Q from left to right and Repeat steps to 6 for each element of Q until the STACK is empty.
Step 3 : If an opperand is encountered, add it to P.
Step 4 : If a left parenthesis is encountered , push it onto STACK.
Step 5 : If an operator * is encountered , then :
(a). Repaetedly pop from STACK and add to P each operator ( on the top of STACK ) which has the same precedence than *.
(b). Add * to STACK.
Step 6 : If a right parenthesis is encountered, then :
(a).
Repaetedly pop from STACK and add to P each operator ( on the top of STACK ) , until a left parenthesis is encountered.
(b).
Remove the left parenthesis.
Step 7 : Exit.