I had a doubt especially when we have all the operators of the same precedence.
Eg. if infix exp. a+b-c+d
then if we convert to postfix by going from left to right it becomes ab+ -d+ (1)
but if we first solve first + sign and then second + sign and then - sign, then the solution becomes ab+cd+ - (2)
So my question was that what is the perfect answer ?
- Both can be answers, both will get marks
- we have to go from left to right only if the precedence of all the operators are same and no parenthesis is used, hence 1 is right and 2 is wrong
- 2nd is right and 1st is wrong
Help me please. Thanks in advance !!