This answer is not selected as best answer. This answer may not be sufficient for exam.
Your limit has been exceed. We have implemented this system because, We got difficulty on managing our servers. Please donate some amount to remove this limit.
Quota: 0 / 30
Algorithm to convert infix to postfix expression
- Scan the infix string from left to right.
- Initialize an empty stack.
- If the scanned character is an operand, add it to postfix sting
- If the scanned character is an operator, PUSH the character to stack.
- If the top operator in stack has equal or higher precedence than scanned operator then POP the operator present in stack and add it to postfix string else PUSH the scanned character to stack.
- If the scanned character is a left parenthesis ‘(‘, PUSH it to stack.
- If the scanned character is a right parenthesis ‘)’, POP and add to postfix string from stack until an ‘(‘ is encountered. Ignore both ‘(‘ and ‘)’.
- Repeat step 3-7 till all the characters are scanned.
- After all character are scanned POP the characters and add to postfix string from the stack until it is not empty.
Infix expression: A*B+C
Postfix expression: AB*C+