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

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

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

  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

  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.

  Describe sorting algorithms and how they work

Describe sorting algorithms and how they work

  Data structures and algorithms

Provides learners with an understanding of how data structures are used in algorithms and enables them to design and implement data structures

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Addition and subtraction of numbers in binary

Addition and Subtraction of numbers in binary and round to the nearest decimal number with three significant decimal digits

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

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