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)