Reverse Polish Notation
Page 1 of 1 • Share •
Reverse Polish Notation
Reverse Polish Notation is a different way of entering equations into a calculator (usually HP, not TI). It allows the user to enter complex equations faster, and also allows the calculator to compute faster using stacks rather than string algorithms.
The numbers are entered backwards: to enter 2+4 on an HP, type 2 ENTER 4 +. Pressing 2 then enter tells the calculator to enter 2 into memory. Then, press 4 and + to add 4 onto the number last stored (at the top of the stack).
Parentheses do not need to be entered. To enter 3*(2+4) type 3 ENTER 2 ENTER 4 + *.
Stacks
Numbers are stored in a stack, with Last In First Out (LIFO). Meaning that the last number entered is the first number removed.
So, taking the equation 3*(2+4), here is the stack as each number is entered in as 3 ENTER 2 ENTER 4 + *.
Starting with an empty stack:
Pushes the 3 into the stack.
Pushes the 2 into the stack.
It removes the 2 at the top and adds 4 to it:
As no number is entered, it removes the last 2 numbers in the stacks and multiplies them.
The numbers are entered backwards: to enter 2+4 on an HP, type 2 ENTER 4 +. Pressing 2 then enter tells the calculator to enter 2 into memory. Then, press 4 and + to add 4 onto the number last stored (at the top of the stack).
Parentheses do not need to be entered. To enter 3*(2+4) type 3 ENTER 2 ENTER 4 + *.
Stacks
Numbers are stored in a stack, with Last In First Out (LIFO). Meaning that the last number entered is the first number removed.
So, taking the equation 3*(2+4), here is the stack as each number is entered in as 3 ENTER 2 ENTER 4 + *.
Starting with an empty stack:
 Code:
Pushes the 3 into the stack.
 Code:
3
Pushes the 2 into the stack.
 Code:
2
3
It removes the 2 at the top and adds 4 to it:
 Code:
6
3
As no number is entered, it removes the last 2 numbers in the stacks and multiplies them.
 Code:
18
Michael Graduated member
 Number of posts : 151
Age : 27
Registration date : 20080430
Similar topics
» Polish Cap Badge
» Polish Air Force
» Polish Parachute Brigade and Armoured Division
» Recurring Dreams About Car Going In Reverse
» 5 GREEN SMOOTHIES THAT LITERALLY REVERSE TYPE 2 DIABETES IN 1 WEEK
» Polish Air Force
» Polish Parachute Brigade and Armoured Division
» Recurring Dreams About Car Going In Reverse
» 5 GREEN SMOOTHIES THAT LITERALLY REVERSE TYPE 2 DIABETES IN 1 WEEK
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum

