Question

Evaluate the postfix expressions using stacks 12 14 + 12 / 12 14 *

Evaluate the postfix expressions using stacks

12 14 + 12 / 12 14 *

Homework Answers

Answer #1

12 14 + 12 / 12 14 *

Push 12

12

Stack

12 14 + 12 / 12 14 *

Push 14

14

12

       Stack

12 14 + 12 / 12 14 *

Pop 14 and 12 apply operator +

12 + 14 = 26, push 26 into the stack

26

Stack

12 14 + 12 / 12 14 *

Push 12

   12

   26

  Stack

12 14 + 12 / 12 14 *

Pop 12 and 26 apply operator /

26 / 12 = 2.167, push 2.167 into the stack

Push 2.167

2.167

Stack

12 14 + 12 / 12 14 *

Push 12

12

2.167

Stack

12 14 + 12 / 12 14 *

Push 14

14

12

2.167

  Stack

12 14 + 12 / 12 14 *

Pop 14 and 12 apply operator *

12 * 14 = 168, push 168 into the stack

Push 168

168

2.167

Top of the stack is 168 So result is 168

Result: 168

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
For the postfix expressions, 32 5 3 + / 5 *, trace the algorithm for evaluating...
For the postfix expressions, 32 5 3 + / 5 *, trace the algorithm for evaluating postfix expressions by showing the contents of the stack immediately before each of the tokens marked with a caret is read. Also, give the value of the postfix expression.
Convert the following infix expressions to postfix. a * b + c – d a +...
Convert the following infix expressions to postfix. a * b + c – d a + b / (c + d)
(For Python) Evaluating Postfix Arithmetic Expressions. In this project you are to implement a Postfix Expression...
(For Python) Evaluating Postfix Arithmetic Expressions. In this project you are to implement a Postfix Expression Evaluator as described in section 7-3b of the book. The program should ask the user for a string that contains a Postfix Expression. It should then use the string's split function to create a list with each token in the expression stored as items in the list. Now, using either the stack classes from 7.2 or using the simulated stack functionality available in a...
Use C++ Your program should expect as input from (possibly re-directed) stdin a series of space-...
Use C++ Your program should expect as input from (possibly re-directed) stdin a series of space- separated strings. If you read a1 (no space) this is the name of the variable a1 and not "a" followed by "1". Similarly, if you read "bb 12", this is a variable "bb" followed by the number "12" and not "b" ,"b", "12" or "bb", "1" ,"2". Your program should convert all Infix expressions to Postfix expressions, including expressions that contain variable names. The...
A deck of cards is divided randomly into two stacks A and B of 14 and...
A deck of cards is divided randomly into two stacks A and B of 14 and 38 cards respectively. You pick a card from the decks, what is the probability of drawing:       (a) An ace of hearts from stack A?       (b) An ace of hearts from stack B?       (c) Are the above two events independent?
A deck of cards is divided randomly into two stacks A and B of 14 and...
A deck of cards is divided randomly into two stacks A and B of 14 and 38 cards respectively. You pick a card from the decks, what is the probability of drawing: (a) An ace of hearts from stack A? (b) An ace of hearts from stack B? (c) Are the above two events independent?
by using Fortran.90 solve the below? Q)Write a program, order.fortran.90, to evaluate the following three expressions:...
by using Fortran.90 solve the below? Q)Write a program, order.fortran.90, to evaluate the following three expressions: x=a*b+c*d+e/f**g y=a*(b+c)*d+(e/f)**g z=a*(b+c)*(d+e)/f**g
Write a java class program to convert from INFIX TO POSTFIX Using stack operations
Write a java class program to convert from INFIX TO POSTFIX Using stack operations
Question 3. Using the values ??? ??° = ?/? and ??? ??° = √?/? to evaluate...
Question 3. Using the values ??? ??° = ?/? and ??? ??° = √?/? to evaluate the following expressions. Show your work. (1.) ??? ??° ??? ??° (2.) ???2 ??° − ???2??° (3.) ? − ? ???2 ??° (4.) ? ???2 ??° − 2
With a programmable calculator (or a computer), it is possible to evaluate the expressions for the...
With a programmable calculator (or a computer), it is possible to evaluate the expressions for the sums of areas of approximating rectangles, even for large values of n, using looping. (On a TI use the Is> command or a For-EndFor loop, on a Casio use Isz, on an HP or in BASIC use a FOR-NEXT loop.) Compute the sum of the areas of approximating rectangles using equal subintervals and right end points for n = 10, 30, 50, and 100....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT