Prefix to Postfix Calculator is a free tool to calculate the postfix of a prefix notation.
Steps to use Prefix to Postfix Converter
Step 1: Enter your prefix expression in the text box below.
Step 2: Click the "Convert" button.
Step 3: The equivalent postfix expression will be displayed below.
Prefix Expression
An expression is called a prefix expression if the operator appears in the expression before the operands. Simply of the form (operator operand1 operand2).
Example : *+AB-CD
Postfix Expression
An expression is called a postfix expression if the operator appears in the expression after the operands. Simply of the form (operand1 operand2 operator).
Example : AB+CD-*
Prefix to Postfix Conversion
To convert a prefix to a postfix expression, we will use a stack to hold the operands. Whenever an operator is found, we pop two operands from the stack and push a new operand. The final element at the top of the stack will be our postfix expression.
Prefix to Postfix Examples:
Example: Convert Prefix Notation : *+AB-CD into postfix notation.
Steps of conversion :
We will travel from right to left and put operands in stack and when we find any operator take two operands from top and do the operation and put result on the stack in the end whatever expression is on the top of stack will be our result.
- *+AB-CD
- *+AB(CD-)
- *(AB+)(CD-)
- (AB+)(CD-)*
- AB+CD-*
Postfix Notation : AB+CD-*
Example : Convert prefix Notation*-A/BC-/AKL into postfix notation
Steps of Conversion:
- *-A/BC-(AK/)L
- *-A/BC((AK/)L-)
- *-A(BC/)((AK/)L-)
- *(A(BC/)-)((AK/)L-)
- (A(BC/)-)((AK/)L-)*
- ABC/-AK/L-*
Postfix Notation : ABC/-AK/L-*