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


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


Write a Review


Data Structure & Algorithms Questions & Answers

  Cloud computing assignment

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

  Data structures and algorithm design

Data Structures and Algorithm Design

  Different applications of data structure

What are the different applications of Data Structure

  Data structures for a single algorithm

Data structures for a single algorithm

  Recursive tree algorithms

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

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Currency conversion development

Currency Conversion Development

  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

  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.

  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

  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