How to evaluate Reverse polish notation using stacks

algorithm, postfix-notation, rpn, stack

Solution

Yes, it can.

S = new empty stack
while not eof
    t = read token
    if t is a binary operator
        y = pop(S)
        x = pop(S)
        push(S, t(x, y))
    else
        push(S, t)
print the contents of the stack S

Problem

Can this postfix expression can be evaluated? ``` 6 2 3 + - 3 8 2 / + * 2 5 3 + ```

Original source