Infix to Reverse Polish notation

2 replies · 4K views · last reply
itech4814
Messages
10
Reaction score
0
I have to convert..

X=A+((B+C)*D)-E

to reverse polish notation

I think it's...

BC+D*A+E-

Is this correct?
 
Yes, that's one way to do it (verified on my HP calculator that uses RPN).

There are other ways, of course. For example, there's one that has the numbers in the sequence that they appear in the original infix expression. Can you figure that one out? It might be useful if you have to write a program that converts infix to RPN.