Convert (A+B)*C in to postfix form.
Answers
Let’s interpret the troublesome expression A + B * C using operator precedence. B and C are multiplied first, and A is then added to that result. (A + B) * C would force the addition of A and B to be done first before the multiplication. In expression A + B + C, by precedence (via associativity), the leftmost + would be done first.
Answer is:
AB+C *
Explanation:
------------------
There are Two stack such as operator stack and operand stack(operator stack is used to push/pop the operators and operand stack is used push/pop the operands)
1)first "( " push to the operator stack
2)A push to the operand stack
3)+ push to the operator stack
4)B push to the operand stack
5) ) push to the operator stack .(" Between braces all element will be pop")
6)now AB+
7)* push to the operator stack
8) C push to the operand stack
Now ans is: AB+C*
Thank you