INFIX to POSTFIX conversion has the following steps:
- If the character is an operand place it on to the output.
- If the character is an operator, push it onto the Stack. if the stack operator has a higher or equal priority than input operator then pop that operator from the stack and place it onto the output.
- If the character is a left parenthesis,push it onto the stack.
- If the character is a right parenthesis, pop all the operator from the stack till it encounters left parenthesis, discard both the parenthesis in the output.
'*' has higher priority
EXAMPLE
Convert infix expression ((A/B)+C) to postfix expression.
EXAMPLE
Convert infix expression ((A/B)+C) to postfix expression.
No comments:
Post a Comment