ELI5: Explain Like I'm 5

Reverse Polish notation

Reverse Polish Notation (RPN) is a way of writing maths expressions. It's like normal maths, but instead of writing the numbers and symbols in a certain order, you write the symbols after the numbers.

Imagine you have to solve the expression: 2 + 3. In regular maths, you would write it like this: 2 + 3. In RPN, you would write it like this: 2 3 +.

You see how the plus sign comes after the numbers? That's what makes RPN different. You always write the numbers first, then the operation symbol.

Another example: 5 − 1 would be written as 5 1 −. And 4 × 6 would be written as 4 6 ×.

The benefit of using RPN is that it removes the need for parenthesis. In regular maths, you might have to write an expression like this: (3 + 4) × (5 − 2). In RPN, you would write it like this: 3 4 + 5 2 − ×.

To solve an RPN expression, you work from left to right. You start with the first number, then the second number, then the operation between them. So if you needed to solve the RPN expression 2 3 +, you would do 2 + 3 and get 5.

RPN is a useful way of writing maths expressions when programming calculators or computers because it simplifies the code needed to evaluate expressions.