M
Markus Dehmann
I have n sets of elements. I want to find elements that occur more than once
in more than one set.
Maybe the following example shows what I mean:
S1 = {1,2,3,2,4}
S2 = {2,2,4,5,4}
S2 = {2,5,2}
The algorithm should find that the "2" occurs more than once in S1, S2, and
S3 (it should also give me the position of the "2" in each of these sets).
All the other members are irrelevant (the "4", for example), since for them
it is not true that they occur more than once in two or more sets.
What is the most efficient way to do this? It is maybe more a general
computer science question, but maybe there are STL tricks that could be
useful in computing this?
Markus
in more than one set.
Maybe the following example shows what I mean:
S1 = {1,2,3,2,4}
S2 = {2,2,4,5,4}
S2 = {2,5,2}
The algorithm should find that the "2" occurs more than once in S1, S2, and
S3 (it should also give me the position of the "2" in each of these sets).
All the other members are irrelevant (the "4", for example), since for them
it is not true that they occur more than once in two or more sets.
What is the most efficient way to do this? It is maybe more a general
computer science question, but maybe there are STL tricks that could be
useful in computing this?
Markus