Output: a number representing the value of that expression

Create a work stack. It will be a stack of numbers.

While there are more tokens in the input

Get the next token

If the token is a number, push it onto the stack

If the token is an operator

Pop the stack to get the value of the expressionIf the token is a number, push it onto the stack

If the token is an operator

Pop the stack twice, getting two
operands

Apply the operator to the two operands, in the correct order

Push the result onto the stack

Apply the operator to the two operands, in the correct order

Push the result onto the stack

Output: a list of tokens representing the equivalent postfix expression

Create a work stack. It will be used as a stack of operators.

While there are more tokens to read from the infix list

Get the next token

If the token is a number, add it to the postfix list

If the token is an operator,

While there are more tokens on the stackIf the token is a number, add it to the postfix list

If the token is an operator,

While the stack is not empty and
the top item on the stack has greater or equal priority than the
token

Pop an operator from the stack
and add it to the postfix list

Push the token onto the stackPop them one at a time and add them
to the postfix list