Question: Union and Intersection of two sets: A set is a collection of similar elements. A union of two sets A and B is a set

Union and Intersection of two sets: A set is a collection of similar elements. A union of two
sets A and B is a set of elements in which each element belongs to set A, set B, or both. It is
represented as A U B.
For example:
A ={1,3,5,7}
B ={3,6,7,9,11}
then A U B ={1,3,5,6,7,9,11}
The intersection of two sets A and B is a set of elements in which each element belongs to
both sets A and B. It is represented as A \Lambda B.
For example
A ={1,3,5,7}
B ={3,6,7,9,11}
Then A \Lambda B ={3,7}.
Write a function in c++ language that takes the following parameters:
Four input parameters : Set A and its size, and the set B and its size.
Four output parameters : Intersect set and its size, Union set and its size
The function should return two arrays and their sizes as output. One array holds the
union of array A and B, and the other holds the intersection of the two sets.
Test you program by writing a main function and passing array A ={1,3,5,7} and B ={3,
6,7,9,11}.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!