这个后缀表达式可以求值吗?
6 2 3 + - 3 8 2 / + * 2 5 3 +
最佳答案
是的,它可以。
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
关于algorithm - 如何使用堆栈评估反向抛光符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40328938/