Question

Evaluating Postfix Expressions operandpop stack sperandi perde operand2 - pop stack result-ord er Figure 7-8 2 .4 The action have to solve in this way please help


Exercise : 1 2 3 Change the following expression from infox to postfix ( A B ) + (C-D/E) 2.5°(((9+8) (46))+7) 3. A(B+(C+D)(EF basic question is :
0 0
Add a comment Improve this question Transcribed image text
Answer #1


Postfix Evaluation stack contains operands, bct we want cakulate the value POSTFIX conversion stack contains Operation since * Insert Into postfix ExprZ AB*CD → push - + (-/ + Insert Into postfix AB* CDE e pop until c and Insert into postfix Expr = A* push * *(( * push a *((*C Expx = 59844 + push * *((*(* *(C * *Expx = 598+46 → pop till ( Exprs 598+46 * » Pop Fic Expre 598key entered OUTPUT A A* (B+(C+D)*(E+F/G)*H Postfix generation Action Stack Contents OUTPUT SYMBOL PUSH * PUSH OUTPUT SYMBOL Pkey entered 4 OUTPUT 2 412*3-3+8/4/(1+1) Postfix generation Action Stack Contents OUTPUT SYMBOL PUSH^ OUTPUT SYMBOL POP, PUSH

Add a comment
Know the answer?
Add Answer to:
have to solve in this way please help basic question is : Evaluating Postfix Expressions operandpop...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Stacks are used by compilers to help in the process of evaluating expressions and generating machine...

    Stacks are used by compilers to help in the process of evaluating expressions and generating machine language code.In this exercise, we investigate how compilers evaluate arithmetic expressions consisting only of constants, operators and parentheses. Humans generally write expressions like 3 + 4and 7 / 9in which the operator (+ or / here) is written between its operands—this is called infix notation. Computers “prefer” postfix notation in which the operator is written to the right of its two operands. The preceding...

  • Help me to fix this code in C language. This code converts infix expressions to postfix and then evaluate the expression...

    Help me to fix this code in C language. This code converts infix expressions to postfix and then evaluate the expression. Right now, it works with single digits. I need to modify it so that it can evaluate expressions with also 2 digits, example: (60+82)%72. Additionally I need to display an error when the parenthesis don't match like (89+8(. I have muted some line that would print the postfix expression with a space like: 22 8 + when the input...

  • I need assistance with this code. Is there any way I can create this stack class (dealing with infix to postfix then postfix evaluation) without utilizing <stdio.h> and <math.h>? ________...

    I need assistance with this code. Is there any way I can create this stack class (dealing with infix to postfix then postfix evaluation) without utilizing <stdio.h> and <math.h>? ____________________________________________________________________________________________ C++ Program: #include <iostream> #include <string> #include <stdio.h> #include <math.h> using namespace std; //Stack class class STACK { private: char *str; int N; public: //Constructor STACK(int maxN) { str = new char[maxN]; N = -1; } //Function that checks for empty int empty() { return (N == -1); } //Push...

  • In c++ Section 1. Stack ADT – Overview  Data Items The data items in a stack...

    In c++ Section 1. Stack ADT – Overview  Data Items The data items in a stack are of generic DataType. This means use should use templating and your Node class. Structure  The stack data items are linearly ordered from the most recently added (the top) to the least recently added (the bottom). This is a LIFO scheme. Data items are inserted onto (pushed) and removed from (popped) the top of the stack.  Operations  Constructor. Creates an empty stack.  Copy constructor....

  • JAVA, please You must write a robust program meaning that your program should not crash with...

    JAVA, please You must write a robust program meaning that your program should not crash with any given data. Data validation must be done any time that user enters an input. Write a program that 1. Gets an infix expression form the user and evaluate the expression using stack ADT a. Finds the postfix equivalent of the given infix expression b. Evaluate the created postfix expression. c. Note: your program should not crash when you enter an invalid expression such...

  • EVALUATING GENERAL INFIX EXPRESSIONS INTRODUCTION The notation in which we usually write arithmetic expressions is called infix notation;...

    EVALUATING GENERAL INFIX EXPRESSIONS INTRODUCTION The notation in which we usually write arithmetic expressions is called infix notation; in it, operators are written between their operands: X + Y. Such expressions can be ambiguous; do we add or multiply first in the expression 5 + 3 * 2? Parentheses and rules of precedence and association clarify such ambiguities: multiplication and division take precedence over addition and subtraction, and operators associate from left to right. This project implements and exercises a stack-based algorithm that evaluates...

  • Total point: 15 Introduction: For this assignment you have to write a c program that will...

    Total point: 15 Introduction: For this assignment you have to write a c program that will take an infix expression as input and display the postfix expression of the input. After converting the postfix expression, the program should evaluate the expression from the postfix and display the result. What should you submit? Write all the code in a single file and upload the .c file. Problem We as humans write math expression in infix notation, e.g. 5 + 2 (the...

  • By using PYTHON language Postfix to Infix using Stack Develop a stack application that can convert...

    By using PYTHON language Postfix to Infix using Stack Develop a stack application that can convert Postfix notation to Infix notation using the following algorithm. In your stack application, you can use only two stacks, one for a stack that can store Postfix notation, and the other is a stack to store infix notation. Also, it would help if you had a function to distinguish between an operation or an operand. Input A B C * + D E /...

  • PLease give me this question Answer. Write working assembly code that successfully executes the ...

    PLease give me this question Answer. Write working assembly code that successfully executes the following stack reverse Polish (postfix) based code. Your code must include the use of sub-routines Push, Pop, Subtract, Add Push A Push B Push C Add Push D Push F Subtract Subtract Push E Add Add Pop X A, 3 B, 5 C, 7 D, 2 E, 4 F, 1 What is the final value for X?

  • write a C program that evaluate algebraic expressions over real numbers in Reverse Polish Notation (RPN)

    Your program must evaluate algebraic expressions over real numbers in Reverse Polish Notation (RPN). + (addition), - (subtraction), * (multiplication) and / (division) should be treated as arithmetic operations. Depending on the selection, numerical values must be entered and displayed in decimal, hexadecimal or binary form. Example: The expression ((3+4) *(7+1.6-12) -5) / (3-8.7)Will be calculated on your RPN calculator as 3 4 + 7 1.6 + 12 - * 5 - 3 8.7 - / Your RPN computer's user...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT