Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3a. Convert the following formula from postfix (Reverse Polish Notation) to infi

ID: 3689050 • Letter: 3

Question

3a. Convert the following formula from postfix (Reverse Polish Notation) to infix:

        AB+C+D*

3 b.    Convert the following formula from infix to postfix (Reverse Polish Notation):

        ( A + B * C) / ( D + E * F)

Write code that performs the computation in problem 3b

        ( A + B * C) / ( D + E * F)                           

using CPUs that have the following instruction formats:

You may only use registers A through F, plus X and T.

Registers A through F may not be changed, i.e. their values are fixed.

Register T may be used as a temporary register, and Register X must contain the final answer.

4 a.    Three-operand instructions   

4 b.    Stack instructions

       

Explanation / Answer

Answer for Question:

AB+C+D * = > (A+B) * (C+D)

(A+B*C) / (D+E*F) => BC*A+ EF*D+/

Three-operand instructions

SUB X, B, C
ADD X, X, A
MUL Z, E, F
ADD Z, Z, D
DIV X, X, Z

Stack instructions

PUSH / A
PUSH / B
ADD
PUSH /C
MUL
PUSH / D
PUSH E
ADD
PUSH F
MUL
DIV
POP / X
off the stack

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote