Infix, Postfix, and Prefix notations are three different but equivalent ways of writing expressions.

Postfix, also known as Reverse Polish Notation (RPN), and Prefix, known as Polish Notation, are alternative formats.

  • Infix: Operators are placed between operands. Example: A + B
  • Postfix: Operators come after operands. Example: AB+
  • Prefix: Operators precede operands. Example: +AB

Here are additional examples:

InfixPostfixPrefixNotes
A * B + C / DA B * C D / ++ * A B / C DMultiply A and B, divide C by D, then add the results.
A * (B + C) / DA B C + * D // * A + B C DAdd B and C, multiply by A, then divide by D.
A * (B + C / D)A B C D / + ** A + B / C DDivide C by D, add B, then multiply by A.