Prefix, Infix, and Postfix Notation

For various arithmetic expressions, this Demonstration displays the binary expression tree as well as the prefix, infix, and postfix notation for the expressions.
In contrast to traditional notation, which is essentially infix notation, prefix notation places the binary operator before the two symbols on which it acts. Similarly, in postfix notation, the operator is placed after the symbols.
These notations correspond to the preorder, inorder, and postorder traversals of the tree, respectively. Parentheses are sometimes required for infix notation (see snapshots 1 and 2), but prefix and postfix notation are unambiguous and require no parentheses (compare snapshots 3 and 4).
  • Contributed by: Marc Brodie (Wheeling Jesuit University)

SNAPSHOTS

  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.