+ 2

What is the program for addition of two sets using c language?

Please. Im not able to make code for addition of two sets

29th Jul 2018, 2:16 PM
Nikita Desale
Nikita Desale - avatar
3 Respostas
+ 1
I want to add two sets of integer
30th Jul 2018, 12:32 PM
Nikita Desale
Nikita Desale - avatar
0
Hi Dnyaneshwari, The code will depend on which is the type of your set elements. For example, if they are integer you can even think in doing addition using bitsets, if they are strings you will need to do more comparisons, and if they are floating point you will need to be careful with rounding errors. I can help with the code when you provide more details.
30th Jul 2018, 9:29 AM
Mark
0
Hi Dnyaneshwari, Here is a code for integers. Notice that by definition sets do not have repeated elements. The space requirements is O(M+N), and time complexity is O(KlogK), where K = max(M,N), M is the size of set A and N is size of set B. https://code.sololearn.com/cNOJalbo9UBV/?ref=app
31st Jul 2018, 10:12 AM
Mark