Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Reverse Polish notation
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Explanation == In reverse Polish notation, the [[operation (mathematics)|operator]]s follow their [[operand]]s. For example, to add 3 and 4 together, the expression is {{nowrap|3 4 +}} rather than {{nowrap|3 + 4}}. The conventional notation expression {{nowrap|3 β 4 + 5}} becomes {{nowrap|3 (enter) 4 β 5 +}} in reverse Polish notation: 4 is first subtracted from 3, then 5 is added to it. The concept of a ''[[stack (data structure)|stack]]'', a last-in/first-out construct, is integral to the left-to-right evaluation of RPN. In the example {{nowrap|3 4 β}}, first the 3 is put onto the stack, then the 4; the 4 is now on top and the 3 below it. The subtraction operator removes the top two items from the stack, performs {{nowrap|3 β 4}}, and puts the result of β1 onto the stack. The common terminology is that added items are ''pushed'' on the stack and removed items are ''popped''. The advantage of reverse Polish notation is that it removes the need for order of operations and parentheses that are required by [[infix notation]] and can be evaluated linearly, left-to-right. For example, the infix expression {{nowrap|(3 + 4) Γ (5 + 6)}} becomes {{nowrap|3 4 + 5 6 + Γ}} in reverse Polish notation.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Reverse Polish notation
(section)
Add topic