For the following, write the expression given in the other two forms listed.
1. infix: (A + B) * C + D / (E + F * G) - H
postfix: A B + C *
D E F G * + / + H -
prefix: - + * + A
B C / D + E * F G H
2. postfix: A
B && C || E F > ! ||
infix: (A &&
B) || C || ! (E > F)
prefix: || || &&
A B C ! > E F
3. infix: ! (A
&& ! ((B < C) || (C > D))) || (C < E)
postfix: A B C <
C D > || ! && ! C E < ||
prefix: || ! &&
A ! || < B C > C D < C E
4. postfix: A
B C D * - E / + F + G H / -
infix: A + ((B - C
* D) / E ) + F - G / H
prefix: - + + A /
- B * C D E F / G H
5. prefix: -
/ + * A B C D / E + F G
infix: (A * B + C)
/ D - E / (F + G)
postfix: A B * C
+ D / E F G + / -
6. infix: A -
B - C * (D + E / F - G) - H
postfix: A B - C D
E F / + G - * - H -
prefix: - - - A B
* C - + D / E F G H
7. What postfix
expression is equivalent to the following infix expression?
(A + B) - C * D / (E - F / G)
A B + C D * E F G / - / -
8. What infix expression is equivalent to the following postfix expression?
A B * C / D E + F G H / * - +
A * B / C + (D + E - (F * (G / H)))
9. What is the value of the following postfix expression?
54 6 + 7
4 - * 9
/ 35 15 +
+
70
10. Use the conversion algorithm to change the following infix expression into postfix.
(A * B - (C - D)) / (E + F)
input symbol stack output string
( (
A ( A
* ( * A
B ( * A B
- ( - A B *
( ( - ( A B *
C ( - ( A B * C
- ( - ( - A B * C
D ( - ( - A B * C D
) ( - A B * C D -
) A B * C D - -
/ / A B * C D - -
( / ( A B * C D - -
E / ( A B * C D - - E
+ / ( + A B * C D - - E
F / ( + A B * C D - - E F
)
/
A B * C D - - E F +
A B * C D - - E F + /