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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started