Converting an expression from infix to postfix

Assignment Help C/C++ Programming
Reference no: EM131740239 , Length: 1

Apply the following algorithms in c++:

1- Converting an expression from infix to postfix

opstk= the empty stack;
while (not end of input) {
symb=next input character;
if (symb is an operand)
add symb to the postfix string
else {
while (!empty()&&prcd(stacktop(), symb)) {
topsym=pop();
add topsymbto the postfix string;
} /*end while*/
if (empty() II symb != ‘)')
push(symb);
else /* pop the open parenthesis and discard it */
topsymb= pop();
} /* end else*/
} /* end while*/
/*output any remaining operators*/
while (!empty()) {
topsymb=pop();
add topsymb to the postfix string;
} /* end while*/

2- Evaluating a postfix expression

Opndstk= the empty stack;
/* scan the input string reading one element at a time into symb*/
while (not end of input) {
symb=next input character;
if (symb is an operand)
push(symb);
else{
/* symb is an operator*/
opnd2=pop();
opnd1=pop();
value=resulr of applying symb to opnd1 and opnd2;
push(value);
} /* end else*/
} /* end while*/
return (pop());

Reference no: EM131740239

Questions Cloud

Trading in the markets on a day-to-day basis : Given that a company receives funds only from transactions in the primary market for common stock, why should financial managers care.
Implement the given operations of a queue using stacks : Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front of queue.
How is kac pushing art forward in the digital age : How is Kac pushing art forward in the digital age? Use examples from the presentation. Why do you feel this way towards his work?
Define technique used to compare the equality of means : ANOVA is a hypothesis testing technique used to compare the equality of means for two or more groups
Converting an expression from infix to postfix : Data structures CS-214 - Converting an expression from infix to postfix and Evaluating a postfix expression -
Discuss the issues of availability versus confidentiality : Discuss the issues of availability versus confidentiality of the DR and BC plans. The recommendation is for all DR team members to have several copies.
In economics what is meant by an oligopoly : What are some ways to make a distinction between an Oligopolistic Market and a Market identified as having Monopolistic Competition?
What are the key characteristics of a simulation : Define the terms "Game" and "Simulation" as they relate to eLearning.What are the key characteristics of a Simulation?
Write a report paper about absenteeism employees : Write a report paper about absenteeism employees. It tells you the purpose of the report, how the issue was investigated, a findings ...

Reviews

len1740239

11/28/2017 1:02:50 AM

The discussion will be in the lab lecture at week 12. You have to send your answer before your lab lecture. Data structures CS-214 Apply the following algorithms in c++: Evaluating a postfix expression - pop the open parenthesis and discard

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd