My friend said he had created his own math notation! His notation worked perfectly for him but was unreadable for others. I can’t imagine writing expressions in any other way!

Turns out, there are other ways.

Infix, Prefix, and Postfix expressions

Our standard notation is called infix. We use parenthesis to indicate the order of operations. Operators are between the two operands.

(A+B)*C

In my data structures class, I learned about prefix and postfix notation. The pre/post refers to the location of the operator and allows you to write expressions without delimiters.

Postfix Infix Prefix
AB+C* (A+B)*C *+ABC

Lab

For a lab, we used stacks to read translate x-fix expressions into y-fix expressions. Here is a great calculator which shows how to push/pop from the stack, Prefix-Postfix Converter by raj457036.

This lab was interesting because I normally code as an ends to a mean. This was probably the first time I tried to code with attention to….coding style?? Here is my readme and analysis of my code. The objective of the lab was to write our own stack data structure class from scratch and implement in translating expressions between pre/in/postfix formats.

References

Prefix-Postfix Converter by user raj457036

Free online calculator

Infix to Postfix, Geeks for Geeks