Union and Intersection of Arrays C++

Union and Intersection of Arrays

Let us suppose we have two sorted Arrays

int Arr1[]={1, 3, 4, 5, 7};

int Arr2[]={2, 3, 5, 6};

then UNION will be: {1, 2, 3, 4, 5, 6, 7}

INTERSECTION : {3, 5}

C++ Program for UNION of arrays:

 

OUTPUT:

union and intersection of arrays

C++ Program for INTERSECTION of arrays:

 

OUTPUT:

union and intersection of arrays

Be the first to comment

Leave a Reply