65.5k views
20 votes
Conversion To Postfix

EXAMPLE: A+(B*C-(D/E-F)*G)*H
Stack Input Output
Empty A+(B*C-(D/E-F)*G)*H -
Empty +(B*C-(D/E-F)*G)*H A
+ (B*C-(D/E-F)*G)*H A
+ ( B*C-(D/E-F)*G)*H A
+ (*C-(D/E-F)*G)*H AB
+ (* C-(D/E-F)*G)*H AB
+ (* -(D/E-F)*G)*H ABC
+ (-(D/E-F)*G)*H ABC*
+ (-(D/E-F)*G)*H ABC*
+ (-(/E-F)*G)*H ABC*D
+ (-(/E-F)*G)*H ABC*D
+ (-(/-F)*G)*H ABC*DE
+ (-(- F)*G)*H ABC*DE/
+ (-(- F)*G)*H ABC*DE/
+ (-(-)*G)*H ABC*DE/F
+ (- *G)*H ABC*DE/F-
+ (-*G)*H ABC*DE/F-
+ (-* )*H ABC*DE/F-G
+ *H ABC*DE/F-G*-
+* H ABC*DE/F-G*-
+* End ABC*DE/F-G*-H
Empty End ABC*DE/F-G*-H*+
Convert the following Infix Expression to Postfix, Using the above sample solution
The infix expression. x^y/(5*z)+2
A + B * C + D
(A + B) * (C + D)
A * B + C * D
A + B + C + D
6. 4 + 3 * (6 * 3 - 12)
7. (A + B - C) * (E / F) – (G – H / J)
8. 4 / (3 + 6) + 59
9. (A + B) * C + D / (E + F * G) – H
10. A + ((B - C * D) / E ) + F - G / H
11. (A * B + C) / D - E / (F + G)
12. A - B - C * (D + E / F - G) – H
13. (A + B) - C * D / (E - F / G)
14. A * B / C + (D + E - (F * (G / H)))

User Sheilah
by
4.5k points

1 Answer

0 votes

Answer:

Please find the attachment for the Conversion To Postfix solution:

Step-by-step explanation:

The solution can be defined as follows:

for question 1:
x y\^ \ 5 z * / 2 +

for question 2:
A B C * + D +

for question 3:
A B + C D + *

for question 4:
A B * C D * +

for question 5:
A B + C + D +

for question 6:
4 3 6 3 * 12 - * +

for question 7:
A B + C - E F / G H J / *

for question 8:
4 3 6 + / 59 +

for question 9:
A B + C * D E F G * + H / +

for question 10:
A B C D * - E / + F + G H / -

for question 11:
A B * C + D / E F G + / -

for question 12:
A B - C D E F / + G - H * -

for question 13:
A B + C D * E F G / - / -

for question 14:
A B * C / D E + F G H / * - +

similarly, we solve all queries.

Conversion To Postfix EXAMPLE: A+(B*C-(D/E-F)*G)*H Stack Input Output Empty A+(B*C-example-1
Conversion To Postfix EXAMPLE: A+(B*C-(D/E-F)*G)*H Stack Input Output Empty A+(B*C-example-2
Conversion To Postfix EXAMPLE: A+(B*C-(D/E-F)*G)*H Stack Input Output Empty A+(B*C-example-3
Conversion To Postfix EXAMPLE: A+(B*C-(D/E-F)*G)*H Stack Input Output Empty A+(B*C-example-4
Conversion To Postfix EXAMPLE: A+(B*C-(D/E-F)*G)*H Stack Input Output Empty A+(B*C-example-5
User Molecular Man
by
4.5k points