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.
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...
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)
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?
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....
(Please answer everything and with explanation) Mathematical expressions that evaluate to even and odd integers. In...
(Please answer everything and with explanation) Mathematical expressions that evaluate to even and odd integers. In the expressions below, n is an integer. Indicate whether each expression has a value that is an odd integer or an even integer. Use the definitions of even and odd to justify your answer. You can assume that the sum, difference, or product of two integers is also an integer. (a) 2n + 4 (b) 4n+3 (c) 10n3 + 8n - 4 (d) -2n2...
Evaluate the following expressions and state the type of each expression: int a = 2; int...
Evaluate the following expressions and state the type of each expression: int a = 2; int b = 3; double c = 3.0; 1. b / 2.0 Type: ( double, boolean, decimal, int )? Value: ( answer )? 2. b ! = 3 Type: ( double, boolean, decimal, int )? Value: ( answer )? 3. a >= 2.0 Type: ( boolean, double, char, int )? Value: ( answer )?
Create a program using Binary Trees in Java to do the following 1. Verify a given...
Create a program using Binary Trees in Java to do the following 1. Verify a given expression is balanced in regards to parentheses 2. covert an infix expression to a postfix expression 3. Evaluate the expression Given expressions: String s[] = {"5 + ) * ( 2", " 2 + ( - 3 * 5 ) ", "(( 2 + 3 ) * 5 ) * 8 ", "5 * 10 + ( 15 - 20 ) ) - 25",...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT