- Operator is between operands
- Ex. a+b
Postfix Expression (Reverse Polish Notation):
- Operator comes after operands
- Ex. ab+
Prefix Expression (Polish Notation):
- Operator comes before operands
- Ex. +ab
What is the need to convert infix expression to postfix expression?
As we know, computer can not solve infix expression that we write usually while evaluating arithmetic expressions. Computer first convert infix expression that we have given as input into postfix expression and then using stack it will evaluate the expression.
One of the major application of stack is to convert infix expression to postfix expression and then evaluate the postfix expression.