# Multiple post-fix expressions for an in-fix expression

Today I was learning to convert post-fix expressions to in-fix expressions and vice versa. What I want to know is whether a post-fix expression can have more than one infix representations.

For example, if I consider the following in-fix expression:

A+B-D/X


I get these post-fix expressions:

ABDX/-+


and

AB+DX/-


I didn't use the stack table method for solving these. I did these conceptually and both these expressions evaluate to

A+B-D/X


post-fix expression. I even verified my result with this site and both the post-fix expressions evaluate to:

A+B-D/X

• Are you aware of operator precedence and operator associativity? – Yuval Filmus Mar 26 '19 at 15:35
• Yes, I'm aware of these stuff:-) – user8718165 Mar 26 '19 at 18:13
• Every expression, whether infix or postfix, has a unique parse tree. The two parse trees should match for the two expressions to be considered the same. – Yuval Filmus Mar 26 '19 at 18:48
• Also known as syntax trees. See for example Wikipedia. This is a basic concept in context-free languages, which you might want to brush up on. – Yuval Filmus Mar 26 '19 at 19:04
• @YuvalFilmus Thank you very much for telling me. I finally fully understand it :) – user8718165 Oct 29 '19 at 10:30