What is Postfix Notation?

In postfix notation, the operator appears after the operands, i.e., the operator between operands is taken out & is attached after operands.

Example1 − Translate a ∗ d − (b + c) into Postfix form.


ad ∗ bc + −

Example2 − Convert a + (b ∗⊝ c) is in Postfix form.


Here ⊝ represents the unary minus operator.

a b c ⊝ ∗ +

Example3 − Convert Postfix Expression into Infix Expression using Stack Implementation

a d ∗ bc + −


String SymbolsStack
ad ∗ bc + −
*(a * d)
B(a * d)b
C(a * d)b c
+(a ∗ d)(b + c)
-(a ∗ d)-(b + c)

Example4 − Calculate the value for the postfix expression.

57 + 2 ∗ 3/


This expression can be evaluated by using a stack. Each symbol can be inserted sequence wise & the operator can be applied on operands lying at the top of the stack and next to it.

75 75 + 7
212 2
*2412 * 2
324 3

∴ Answer is 8.

Postfix Notations used in Control Statements

  • Jump − Jump to label 𝑙 can be written in postfix notations as −


  • jlt (Jump if less than) − e1 e2 𝑙 jlt makes the jump to label if e1 has a smaller value than e2.

  • jeqz (jump if equal to zero) − e 𝑙 jeqz causes jump to 𝑙 if e has the value zero.

Example5 − Convert the following statement into postfix Notation.

if e then x else y


If − else statement can be written as

If e then



𝑙1: y

𝑙2: exit

The postfix Notation will be

Example6 − Convert expression into Postfix Notation.

if a then if c + d then a + c else a * c else a + b.


It can be written as

if a then

      if c + d then

            a + c


                a * c



      𝑙2: a + b

      𝑙3: exit

Updated on: 03-Nov-2021

16K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started