- #1
needOfHelpCMath
- 72
- 0
Code:
Here is my problem a*b/c+d/e/f:
*there is no code because professor ask me do hand write it out*
My answer: abc*/def//+is this correct?
Here is my problem a*b/c+d/e/f:
*there is no code because professor ask me do hand write it out*
My answer: abc*/def//+is this correct?
needOfHelpCMath said:Code:Here is my problem a*b/c+d/e/f: *there is no code because professor ask me do hand write it out* My answer: abc*/def//+is this correct?
I like Serena said:Hi needOfHelpCMath! (Smile)
It should be: [M]ab*c/de/f/+[/M]
That's because * and / have the same priority and are evaluated left to right.
So the expression is evaluated as [M]((a*b)/c)+((d/e)/f)[/M].
The postfix expression reflects that.
Infix notation is when operators are placed in between the operands, while postfix notation places operators after the operands.
Postfix notation is preferred because it eliminates the need for parentheses and has a fixed order of operations, making it easier for computers to evaluate expressions.
An algorithm called the shunting-yard algorithm can be used to convert an infix expression to postfix by using a stack to keep track of operators and parentheses.
Converting infix to postfix allows for easier evaluation of expressions, as well as minimizing the use of parentheses and ensuring a fixed order of operations.
Yes, any infix expression can be converted to postfix using the shunting-yard algorithm, as long as the expression follows the rules of infix notation.