Infix Prefix and Postfix Notation for Arithmetic Expressions in Computer Science
An arithmetic or logical expression is a grammatical arrangement of operands (constants, variables, or nested expressions) and operators, and the position of a binary operator relative to its operands defines three notations: infix (operator between operands), prefix or Polish notation (operator before operands), and postfix or reverse Polish notation (operator after operands). Infix is ambiguous on its own because an operand can be claimed by two adjacent operators, so parsing it requires the auxiliary machinery of operator precedence, associativity, and explicit parentheses; in prefix and postfix each operand associates with exactly one operator, so those forms are parenthesis-free and unambiguous without any precedence or associativity rules. The topic sits in computer science at the intersection of expression parsing/evaluation and the stack abstract data type, and motivates the machine preference for postfix — human readability favors infix, while postfix is cheapest to parse and evaluate in time and memory.
D
Data
Video
Infix Prefix and Postfix Notation for Arithmetic Expressions in Computer Science
An arithmetic or logical expression is a grammatical arrangement of operands (constants, variables, or nested expressions) and operators, and the position of a binary operator relative to its operand…