Questions tagged [set-union]

In set theory, the union (denoted by ∪) of a collection of sets is the set of all distinct elements in the collection. It is one of the fundamental operations through which sets can be combined and related to each other. In C++, set_union() constructs a sorted range consisting of all elements present in one or both sorted input ranges.

90 questions
3
votes
1 answer

Joining (union) of Sets inside a Set in Java

I have a map where the values are sets of integers. What i'd want to do is to get in the best way possible (using only the Java API would be great) the union of all the sets of Integers. Map> map; What I thought so far is to…
3
votes
0 answers

What is optimal performance for set merge algorithms?

Assume ordered sets that support O(n) iteration and O(log n) access to single items, what is theoretically optimal complexity for set-union, set-intersection and set-difference? Assume that a dedicated structure could be used for the sets, as long…
3
votes
1 answer

How to join/union contours in OpenCV?

Is suсh operation as "joining" exists/reasonable for contours? Since contour delimits some area on the plane multiple contours can be unioned as sets. Isn't they? If yes then how to union contours?
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
3
votes
1 answer

c++ set_union iterator

I am having some issues with this code, the code is compiling, but when I try to test the vector's contents, the tests are failing. Here is the code: using std::vector; // returns a different vector, containing all elements in v1 and all elements…
Noob
  • 31
  • 1
2
votes
4 answers

Simultaneous Union and Intersection between two maps in C++

While doing a college project I came upon the following problem: I have two maps (Kmer1 and Kmer2) which are composed by a string(key) and a int(value). I have to calculate the distance which follows this formula [1-(I/U)]*100 Where... ...U =…
Pauete Galopa
  • 153
  • 1
  • 1
  • 9
2
votes
2 answers

set_union() is not working for a set of strings

I was trying to find out the union of two set containing strings, using set_union(...) function. But, it's throwing error inside of stl_algo.h ar line no 4948 - Error : passing 'const std::__cxx11::basic_string' as 'this' argument discards…
fardinabir
  • 124
  • 8
2
votes
2 answers

Python union of sets raises TypeError

Consider a sequence of sets: >>> [{n, 2*n} for n in range(5)] [{0}, {1, 2}, {2, 4}, {3, 6}, {8, 4}] Passing them directly into the union method yields the correct result: >>> set().union({0}, {1, 2}, {2, 4}, {3, 6}, {8, 4}) {0, 1, 2, 3, 4, 6,…
farmer
  • 285
  • 1
  • 13
2
votes
1 answer

OWL domain range union

From a previous question I gained an understanding of how intersection works among multiple domains and ranges of a predicate. It seems that union is the more common way to handle this scenario, so now I'm wondering what different inferences are…
jaco0646
  • 15,303
  • 7
  • 59
  • 83
2
votes
3 answers

Union of two sets,manipulating arrays Java

Idea is to calculate union of two collection sets,at the begining of the program,user will be asked to enter the length of desired sets,afterwards he will be prompted to assign the elements in sets,and the final idea is to calculate Union. I have…
Temp034
  • 141
  • 11
2
votes
1 answer

Regular Language Closure Unconcatenation

I'm trying to find an operation that can take a regular language and "unconcatenate" it with another. For example: a*L - a* = L | where L is a regular language I know that difference (subtraction) isn't the operation I want. But I believe I'm…
2
votes
1 answer

Python/Pandas element wise union of 2 Series containing sets in each element

I have 2 pandas data Series that I know are the same length. Each Series contains sets() in each element. I want to figure out a computationally efficient way to get the element wise union of these two Series' sets. I've created a simplified…
Jed
  • 1,823
  • 4
  • 20
  • 52
2
votes
2 answers

Iteration to make a union of sets

I have a dictionary containing sets as the values, and I would like to make a union of all of these sets using a for loop. I have tried using set.union() with a for loop but I do not think this is working, any simple ways to do this iteration? for…
Abdullah Tamimi
  • 97
  • 1
  • 2
  • 7
2
votes
1 answer

Union of arrays over dimension names in R

I have multiple arrays in R. Each array has following structure: a. The dimension names are characters. b.The values in array are frequency of each character. c k j a d l n s 5 5 3 1 1 1 1 1 d j o a h i k q z r 4 4 4 3 2 2 2 1 1 1 …
Guest123
  • 105
  • 3
  • 9
2
votes
2 answers

Median of union of sorted arrays - what to do after recursion ends

I apologize if this question does not belong here, my problem is not with the code, it's with the algorithm, so perhaps it is better suited for another website, but the good people of stackoverflow never let me down. Here is the question: Given 2…
Oria Gruber
  • 1,513
  • 2
  • 22
  • 44
2
votes
0 answers

How to effectively join all intersected vectors?

Let's say I have a vector of vectors: std::vector > vec; Now, in my program, this vector contains groups of nodes that create a cycle in a graph. They create the strongly connected component if they are intersected. I need to loop…
fatum
  • 21
  • 4