# Infix to Postfix ISC SQP 2016

19 views
ago in Computer
closed ago
Convert the following infix notation into postfix:

A * (B / C) / E + F

ago by (985 points)
selected ago by

To convert the infix notation "A * (B / C) / E + F" to postfix notation, we can use the following steps:

1. Create an empty stack and an empty output list.
2. Iterate through each symbol in the infix notation from left to right.
3. If the symbol is an operand (e.g. A, B, C, E, F), add it to the output list.
4. If the symbol is an opening parenthesis (i.e. "("), push it onto the stack.
5. If the symbol is a closing parenthesis (i.e. ")"), pop symbols off the stack and add them to the output list until an opening parenthesis is found. Discard the opening parenthesis.
6. If the symbol is an operator (e.g. "*", "/"), pop operators off the stack and add them to the output list until a lower-precedence operator is found or the stack is empty. Then push the new operator onto the stack.
7. After all symbols have been processed, pop any remaining operators off the stack and add them to the output list.

Using these steps, we can convert the infix notation "A * (B / C) / E + F" to the following postfix notation:

ABC / * E / F +