Today, we went over infix, prefix, postfix notation, and how to convert them.
Homework
Class Notes
Regular math equations include operations and operands
operands are numbers and variables
operations are the actions performed on operands
+, -, *, /
Infix notation is what we normally use to do math
the operation is written between the operands
order of operations (PEMDAS): parenthesis, exponents, multiplication, division, addition, subtraction
Prefix notation and postfix notation are better for computers
In prefix notation, the operation is written before the operands
ex: 2+2 would be +2 2
In postfix notation, the operation is written after the operands
ex: 2+2 would be 2 2+
Why use prefix and postfix notation?
With prefix and postfix, order of operation does not matter and you’ll get the same result no matter what
This is much easier for computers to work with
To convert from infix to prefix/postfix:
Follow the order of operations and fully parenthesize the expression
Convert the sections into prefix/postfix based on the order you would evaluate them