Question: Need help with this 1.Given a string that represents a valid infix-notation equation, use a stack to convert the given string into another that represents

Need help with this

1.Given a string that represents a valid infix-notation equation, use a stack to convert the given string into another that represents the given equation in both prefix and postfix notation. Output these notations starting with prefix then postfix on separate lines. Then, evaluate the postfix expression using a stack implementation. Output the final answer on its own line following the postfix notation.

Case 1:Input: "5*6+9/3/3-6+7*3*4/2+7-3" Output: +*56-/9/33+6+*7*3/42-73

56*93/3/+6-73*4*2/+7+3-

71

Case 2:Input: "1+5*9+5+3*3+7-8-8*7/2"Output: +1+*59+5+*33-7-8*8/72

159*+5+33*+7+8-87*2/-

31

Case 3:Input: "1+2+3+4+5*6/3-5*4"Output: +1+2+3+4-*5/63*55

12+3+4+56*3/+55*-

0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!