Infix to Postfix
I need help how do i write this program using these guidlines:
Let postfix be an empty String and stack be an empty Stack
For each token in the input stream
if operand: Immediately concatenate operand to postfix
if open parentheses: Push "(" on the stack
if close parentheses: Pop stack symbols and attach to postfix until getTop is an open parentheses, then pop "("
if operator: While the stack is not empty, pop all operators as long as they are of equal or higher
precedence and the top is not "(". Concatenate each operator from stack to postfix.
Then push the current operator.
I need to write code on converting infix to postfix, the above algorithm would convert infix to postfix. I need to know how to do this using this algorithm that was given to me. Or can anyone direct me to a site that could possibly have this code thank you.