Infix to Reverse Polish notation

  • Thread starter Thread starter itech4814
  • Start date Start date
  • Tags Tags
    Notation Reverse
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 4K views
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?
 
Physics news on Phys.org
Looks right to me.
 
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.