Infix to postfix converter
Convert an infix expression to postfix (Reverse Polish) or prefix notation the way ISC Computer Science marks it, with the stack after every symbol - or evaluate a postfix expression step by step.
Answer
- Value
- 37
Stack, symbol by symbol
An operand is pushed. An operator pops the top two values (the second popped is on the left), works them out and pushes the result.
| Symbol | Stack (top on the right) | Action |
|---|---|---|
| 5 | 5 | Push 5 |
| 6 | 5, 6 | Push 6 |
| 2 | 5, 6, 2 | Push 2 |
| + | 5, 8 | Pop 2 and 6; push 6 + 2 = 8 |
| * | 40 | Pop 8 and 5; push 5 * 8 = 40 |
| 12 | 40, 12 | Push 12 |
| 4 | 40, 12, 4 | Push 4 |
| / | 40, 3 | Pop 4 and 12; push 12 / 4 = 3 |
| - | 37 | Pop 3 and 40; push 40 - 3 = 37 |
Practise on real ISC questions
- Convert the following infix notation to postfix form. ( A / B + C ) / ( D * ( E − F ) 2024 Specimen
- Convert the following infix notation to postfix notation: $A * (B + C / D) - E / F$ 2022 Specimen
- Convert the following infix expression to postfix form: $P * Q / R + (S + T)$ 2017
- Convert the following infix notation to postfix form: $A + ( B - C * ( D / E ) * F )$ 2018
- Convert the following infix notation to prefix form. $(P + Q / R) * (S + T / U) / V$ 2026 Improvement
- Convert the following infix notation to prefix notation. $(A - B) / C * (D + E)$ 2023
- Convert the following infix notation to postfix form. $(P + Q * R - S) / T * U$ 2024
- For the given Binary Tree, which traversal order will arrange the elements in ascending order? 2025 Practice
- Convert the following infix notation to prefix form: $(X + Y) / (Z * W / V)$ 2020
- Convert the following infix notation to postfix form. (AB^C) + (DE) where B^C = $B^C$ 2025 Improvement
More Computer Science tools
- Boolean algebra solver Simplify any expression: the laws step by step, truth table, K-map and the logic circuit.
- Binary tree and BST tool Build a binary search tree, rebuild a tree from two traversals, and get every traversal and fact.