You are here:

C++/set union and set different.

Advertisement


Question
given set a ={1,2,3,4,}
     set b = {3,4,5,6}
can u give coding for (a union b and )(a different b).An array must be used.

Answer
Hi,
 I would give the steps and please do it yourself:
Step [1] : Sort both arrays
Step[2] : If Union then merge both arrays and then remove duplicates that would be placed adjacent to each other
Step [3] : "A different B" --> Traverse A and copy all the elements in C which do not occur B.


-- Dharmender Rai

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Dharmender Rai

Expertise

I can answer general and system level C/C++ questions.

Experience

I have 5 years of experience in C++.

©2016 About.com. All rights reserved.