Question: For Q1(3) in Assignment 3, you need to first convert the infix expression to its postfix and then evaluate it based on the postfix. Question
For Q1(3) in Assignment 3, you need to first convert the infix expression to its postfix and then evaluate it based on the postfix.

Question 1: Answer the following questions related to the implementation of a simple calculator discussed in Chapter 3. (1) Show your understanding about the postfixC) algorithm discussed in the lecture note and the textbook by showing how to convert the following 2 infix expressions into their postfix expression using a stack step by step. 2 4 2 1 6 (((a b) (c d) f) g h (2) Show your understanding about the eval() algorithm by showing how you evaluate the first infix expression given in (1) using a stack step by step. (3) Assume that you have to handle plus and minus and signs ONLY, for ex- ample, -2 +1 4 3. Show a pseudo code on how you evaluate such infix expressions with explanations. (Hint: the priority of the operator is given in the slide 3-19 in ch3.pptx or Figure 3.12 in the textbook, where the sign and the sign are treated as a unary operator with a higher precedence order.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
