Skip to content
TheCScience
TheCScience

Everything About Education

  • Pages
    • About US
    • Contact US
    • Privacy Policy
    • DMCA
  • Human values
  • NCERT SOLUTIONS
    • Class 12
    • Class 11
  • HackerRank solutions
    • HackerRank Algorithms Problems Solutions
    • HackerRank C solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
TheCScience
TheCScience

Everything About Education

Infix to Reverse Polish Notation Arithmetic Conversion

YASH PAL, December 10, 2025December 10, 2025

Reverse Polish Notation Conversion Rules – To convert a expression from infix notation to reverse polish notation we need to scan the notation from left to right. and for each operand and operator that comes we need to follow some rules –

  1. If operand is variable or constant then we need to push it into the stack
  2. For operator pop the top two data of the stack and perform the operator. and then push the result into the stack.

Let’s understand the conversion using examples.

Example 1 – Convert the following numerical arithmetic expression into RPN and show the stack operations for evaluating the numerical result ( 3 * 4) + (5 * 6).

Solution – In reverse Polish notation, the given numerical arithmetic expression is written as 34 * 56 * +

Stack operation for given expression is shown in below figure. each box represents one stack operation and arrow always points to the top of the stack.

Infix to reverse polish notation conversion
Infix to reverse polish notation conversion

First the number 3 is paused into stack and then number 4. the next symbol is the multiplication operator *. this causes a multiplication of two top most data in stack. the stack is popped and product is placed on the top of the stack.

Now the number 5 and number 6 are pushed into the stack. the next symbol is the multiplication operator *, which causes a multiplication of two top most data in stack. again the stack is popped and product of two numbers is placed on the top of the stack. the last operation causes an arithmetic addition of two topmost numbers in stack the final result is 42 which is stored into stack again.

Computer System Architecture engineering subjects Computer System Architectureengineering subjects

Post navigation

Previous post
©2025 TheCScience | WordPress Theme by SuperbThemes