# more examples of reverse Polish notation

The following examples, presented first in standard infix notation, converted to reverse Polish notation^{} by using the shunting yard algorithm, all use the same four operands but combined with different operators and parentheses. Operators are assumed to be binary.

$(1+2)\times (3+4)$ in standard infix notation becomes $1\mathit{\hspace{1em}}2+3\mathit{\hspace{1em}}4+\mathit{\hspace{1em}}\times $ in reverse Polish notation. Both expressions should evaluate to 21, each in the appropriate calculator.

$1+2\times 3+4$ standard becomes $1\mathit{\hspace{1em}}2\mathit{\hspace{1em}}3\times 4+$ RPN. Both evaluate to 11.

$1+2\times (3+4)$ turns to $1\mathit{\hspace{1em}}2\mathit{\hspace{1em}}3\mathit{\hspace{1em}}4+\mathit{\hspace{1em}}\times \mathit{\hspace{1em}}+$. Evaluate to 15.

$(1+2)\times 3+4$ is $1\mathit{\hspace{1em}}2+3\times 4+$. Evaluate to 13.

Title | more examples of reverse Polish notation |
---|---|

Canonical name | MoreExamplesOfReversePolishNotation |

Date of creation | 2013-03-22 16:10:19 |

Last modified on | 2013-03-22 16:10:19 |

Owner | Mravinci (12996) |

Last modified by | Mravinci (12996) |

Numerical id | 5 |

Author | Mravinci (12996) |

Entry type | Example |

Classification | msc 03B70 |

Classification | msc 68N17 |