For translation of "a b c + * a / c b + d / - " to infix I get:
a*b+c/a-c+b/d
But to translate "a b c + * a / c b + d / - " into prefix I am certainly not getting it.
can someone please help?
Thanks in advance,
Mike
For translation of "a b c + * a / c b + d / - " to infix I get:
a*b+c/a-c+b/d
But to translate "a b c + * a / c b + d / - " into prefix I am certainly not getting it.
can someone please help?
Thanks in advance,
Mike
NEVER PET YOUR DOG WHILE IT'S ON FIRE!
Your translation to infix is wrong, it should be
a * ( b + c ) / a - ( c + b ) / d
( don't forget that you often need parenthesis in with infix notation )
- about your question about changing postfix to prefix, you could just change it to infix first and then change the infix to prefix if that's easier for you.
Hi,
So let me extend the question a little...
does it make sense to factor out any of the redundancy?
essentially, the a's could cancel out to this...
(b+c)-((c+b)/d)
Would this be an ok practice to use?
Thanks in advance,
Mike
NEVER PET YOUR DOG WHILE IT'S ON FIRE!
yes that is an equivalent expression. Wheter you reduce the fraction or not depends on what you want to do. If your assignment is just to change an postfix expression to infix, I wouldn't reduce it because you weren't asked to. But mathematically it is totally correct.