If the input character is an operand, print it.
If the input character is an operator-
If stack is empty push it to the stack.
If ((its precedence value is greater than the precedence value of the character on top) OR (precedence is same AND associativity is right to left)), push.
If ((its precedence value is lower) OR (precedence is same AND associativity is left to right)), then pop from stack and print while precedence of top char is more than the precedence value of the input character.
If the input character is ), then pop and print until top is (. (Pop ( but dont print it.)
If stack becomes empty before encountering (, then its a invalid expression.
Repeat steps 1-4 until input expression is completely read.
Pop the remaining elements from stack and print them.