1. Set postfix string to empty string 2. Create an empty operator stack 3. Repeat 3.1 Get the next token in the infix string 3.2 If next token is an operand (begining with digit), append it to postfix string 3.3 If next token is an operator 3.3.1 Process the next operator Until at the end of the infix string 4. At end of the infix string, keep popping stack until stack is empty 3.3.1 Process the next operator Repeat If operator stack is empty or next operator is ‘(‘, Push next operator onto stack. Else if precedence(next operator) > precedence(top operator) Push next operator onto the stack (ensures higher precedence operators evaluated first) Else Pop the operator stack and append operator to postfix string Until next operator is pushed onto the stack or popped operator is ‘(‘.
Precedence: *, / 2 +, - 1 (, ) 0