An postfix expression (also called Reverse Polish Notation) is a single letter or an operator, preceded by two postfix strings. Every postfix string longer than a single variable contains first and second operands followed by an operator.e.g. A,A B +,A B + C D –.
But in general expressions usually are in infix format.So, we have to convert them into postfix expression.For that you can use Infix to Postfix Converter .
1.First we read expression from left to right.So,During reading the
expression from left to right, push the element in the stack if it is
2.If the current character is an operatorthen pop the two operands from the stack and then evaluate it.
3.Push back the result of the evaluation. Repeat it till the end of the expression.Checkout examples that are mention below in table
Infix expressions are readable and solvable by humans. We can easily distinguish the order of operators, and also can use the parenthesis to solve that part first during solving mathematical expressions. But computer cannot differentiate the operators and parenthesis easily, that’s why postfix conversion is needed.Compilers or command editor in computer and some calculators also convert expression to postfix first and then solve those expression to evaluate answer for the same.