Conversion of Infix To Post Fix
Conversion of Infix To Post Fix
Algorithm:-
1. Add a unique symbol # in to stack and at the end of array infix.
2. Scan symbol of array infix fro left to right.
3. If the symbol is left parenthesis ‘(‘then add in to the stack.
4. If symbol is operand then add it to array post fix.
5. (i) If symbol is operator then pop the operator which have same precedence
or higher precedence then the operator which occurred.
(ii) add the popped operator to array post fix.
(iii) Add the scanned symbol operator in to stack.
6. (i) If symbol is right parenthesis ‘)’ then pop all the operators from stack
until left parenthesis ‘(‘ in stack.
(ii) Remove left parenthesis ‘(‘ from stack.
7. If symbol is # then pop all the symbol form stack and add them to array
post fix except #.
8. Do the same process until # comes in scanning array infix.