Prefix, Infix, and Postfix Notation

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

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) (April 2011)
Open content licensed under CC BY-NC-SA



Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.