50.7k views
0 votes
What is infix, prefix and postfixexpressions in data structures?

User Gidmanma
by
5.6k points

1 Answer

3 votes

Step-by-step explanation:

Infix notation: A+B

Operators are written in-between their operands. Expression X * ( Y + Z) / P is means: "First add Y and Z together, then multiply the result by X, then divide by P to give the final answer."

Postfix notation : A B +

Operands are written before their operators. Expression given above is equivalent to X Y Z + * P /

Operators evaluation is always left-to-right, we will not consider brackets for the order.

Prefix notation : + A B

Operands are written after their operators. Expression given above is equivalent to / * X + Y Z P

Operators evaluation is always right-to-left,we will not consider brackets for the order.

User Caroline Morris
by
4.8k points