Reverse Polish Notation

Using brackets in computing is sometimes an unnecessary complication. Using post-fix expressions ensures that only one order of operation is needed. Postfix is another name for 'reverse Polish' notation.

Infix: 38 + y  
Postfix: 38 y +  

Converting Infix to RPN

((42*3) / 150) + 9

Step 1: Add brackets where needed:  
    (((42*3) / 150) + 9)

Step 2: Start from the inside bracket, and move operators to the right-hand side of the brackets they're in.  
    (((42 3 * ) 150 /) 9 +)

Step 3: Remove all brackets.  
    42 3 * 150 / 9 +

Converting RPN to Infix

42 3 * 150 / 9 +

Step 1: Add brackets.  
    (((42 3 *) 150 /) 9 +)

Step 2: Move operators to their infix positions.  
    (((42 * 3) / 150) + 9)

Step 3: Remove unnecessary brackets.  
    42 * 3 / 150 + 9