+ *bc abc*( ( *+ab-cd ab+cd- * - * * -*bb ** ac bb* * * postfix evaluation algorithm assume we have string of operands and operatorsan informalby hand process is scan the expression left to right skip values or variables (operands when an operator is foundapply the operation to the preceding two operands replace the two operands and operator with the calculated value (three symbols are replaced with one operand continue scanning until only value remains--the result of the expression the time complexity is (nbecause each operand is scanned onceand each operation is performed once more formal algorithmcreate new stack while(input stream is not empty)token getnexttoken()if(token instanceof operand)push(token)else if (token instance of operatorop pop()op pop()result calc(tokenop op )push(result)return pop()demonstration with infix transformation to postfix this process uses stack as well we have to hold information that' expressed inside parentheses while scanning to find the closing ')we also have to hold information on operations that are of lower precedence on the stack the algorithm is create an empty stack and an empty postfix output string/stream scan the infix input string/stream left to right if the current input token is an operandsimply append it to the output string (note the examples above that the operands remain in the same order if the current input token is an operatorpop off all operators that have equal or higher