C++ program to evaluate expressions combining set union

Assignment Help Data Structure & Algorithms
Reference no: EM131833

1 Introduction

You will create a C++ program to evaluate expressions combining set union, set intersection and parentheses. The program must exploit a stack to convert the matrix expressions from inx notation to postx notation and a second stack to evaluate the postx expression.

In order to maintain similar notation to arithmetic expressions, + will denote union and * will be intersection. You will evaluate expressions like A * B +C, (A + B)  (D +E  F) or A  B +(C * D), where A, B, C and D are sets.

We will dene the operation " + " of two sets A and B as the union of the contents of both sets:

                                                  A + B ≡ A U B                          (1)

Similarly, we will dene the operation " * " of A and B as the intersection of A and B:

                                                  A * B ≡ A ∩ B                          (2)

These denitions allow us to write long algebraic equations. We assign to the " + " a lower precedence than " * " (in the same way as we do in algebra) and parentheses change the precedence of an expression.

2 Input

The input is one script le, in the same format as the script le from previous homeworks, and two or more data les containing words. All operations supported in the previous homework (read(), write()) will still be supported. You will need to extend the script parser in order to accept expressions such as

                                                                      R0=(A+B)*C

There will be one expression per line, and there might be multiple expressions in each script le. You are expected to be able to reuse the results from previous expressions.

Reference no: EM131833

Questions Cloud

Develop a strategic plan : Develop a strategic plan for the next three years
Influence the selection of measurement approach : Identify factors that will influence the selection of measurement approach
Import the data into matlab and name the array ace_data : Parameter is related to the energy of the storm, since kinetic energy is proportional to velocity squared. However, it does not take into account the size of the storm, which would be necessary for a true total energy estimate.
Human computer interaction : Write a paper that shows a reasoned, convincing argument for a position on a selected topic.
C++ program to evaluate expressions combining set union : Create a C++ program to evaluate expressions combining set union, set intersection and parentheses
Financial accounting theory : prepare an essay which demonstrates their understanding about the issue
Evaluate the rtas resource requirements : Design and implement a set of classes and interfaces and use them to evaluate the RTA's resource requirements.
Identify the various costs associated with the deployment : Identify the various costs associated with the deployment, operation and maintenance of a mobile-access system. Identify the benefits to the various categories of user, arising from the addition of a mobile-access facility.
Compute area and perimeter of a polygon : Create a project that would let a user compute area and perimeter of a polygon

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Calculate the size of the state space as a function of n

n vehicles occupy squares (1, 1) through ( n , 1) (i.e., the bottom row) of an n × n grid. The vehicles must be moved to the top row but in reverse order

  Different applications of data structure

What are the different applications of Data Structure

  Determine the branching factor

Expalin the search algorithm that results from each of the following special cases. How does it relate to other algorithms we have discussed.

  Currency conversion development

Currency Conversion Development

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Data structures and algorithm design

Data Structures and Algorithm Design

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Survey of fault tolerance policy for load balancing scheme o

This paper investigates about fault-tolerance in load balancing schemes in distributed environment. There are some more parameters influencing QOS but our main focus is on fault tolerance and load balancing.

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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