PCCST303 · Module 1: Basic Concepts of Data Structures

Expression Evaluation

Expressions can be written in three notations, depending on where the operator sits relative to its operands:

Definition

Infix notation places an operator between its operands (A + B). Prefix notation (also called Polish notation) places the operator before its operands (+ A B). Postfix notation (also called Reverse Polish notation) places the operator after its operands (A B +).

Infix:    A + B * C
Prefix:   + A * B C
Postfix:  A B C * +

Expressions can be converted between infix, prefix, and postfix in six different directions, and prefix or postfix can each be evaluated directly, all six-plus-two combinations covered in the Expression Evaluation lesson above.

Note

KTU's Module 1 syllabus scopes this down to exactly two of those: Infix to Postfix conversion and Postfix evaluation. Prefix notation and all conversions involving it are outside this module's syllabus. Don't spend exam-prep time on it.

Key Idea

Both PYQs seen for this topic (a standalone conversion question, and a combined 6-mark question asking for conversion followed by evaluation) stay within this scope. The Infix to Postfix and Postfix Evaluation pages cover both, including the full worked 6-mark PYQ.