Infix, postfix, and prefix expressions
Prefix, postfix, and infix expressions are not a very common interview topic these days, but it can be considered a topic that should be covered at least once by any developer. The following is a quick overview:
- Prefix expressions: This is a notation (algebraic expression) that's used for writing arithmetic expressions in which the operands are listed after their operators.
- Postfix expressions: This is a notation (algebraic expression) that's used for writing arithmetic expressions in which the operands are listed before their operators.
- Infix expressions: This is a notation (algebraic expression) that's typically used in arithmetic formulas or statements where the operators are written in between their operands.
If we have three operators, a, b, and c, we can write the expressions shown in the following image:
The most common problems...