I want to know if there is a way to solve infix expressions in a single pass using 2 stacks?
The stacks can be one for operator and the other for operands...
The standard way to solve by shunt-yard algorithm is to convert the infix expression to postfix(reverse polish) and then solve. I don't want to convert the expression first to postfix.
If the expression is like 2*3-(6+5)+8
, how to solve?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…