Questions tagged [set-operations]

Set operations as a branch of set theory which includes operations such as: Union, Intersection, Subset, Set Difference, Symmetrical Set Difference, and Set Equality.

References

88 questions
0
votes
0 answers

Set Union of two unsorted arrays

//Function to union the arrays for un-sorted arrays void set_union_unsorted(array *arr1, array *arr2) { int *arr3,len=0; arr3 = new int[20]; int i=0; int j=0; int k=0; while (isize) { …
INZAMAM
  • 11
0
votes
1 answer

In pyspark, how do I find values in one column but not in another (set subtraction) after groupby?

I have a pyspark datframe df of records, each record has id and group, and marks whether two events (event1, event2) have occurred. I want to find the number of ids in each group, that: have had both events occurred to them, have had event2 but not…
Yue Y
  • 583
  • 1
  • 6
  • 24
0
votes
0 answers

Set operations with networkx

I am working with networkx and I need to do set operations. Particularly I want to do an intersection between to set of edges. The operations I need involve EdgeView type and set type. The problem is that with the set type the couples within it are…
user8110728
0
votes
0 answers

Efficiently compute xor / symmetric difference of many sets (list of sets)

I have an arbitrary number of Python sets, e.g. >>> a = {1, 2, 3} >>> b = {3, 4, 5} >>> c = {5, 6, 7} >>> d = {7, 8, 1} I want to compute their "combined" symmetric difference, i.e. I want to xor all of them: >>> a ^ b ^ c ^ d {2, 4, 6, 8} In my…
s-m-e
  • 3,433
  • 2
  • 34
  • 71
0
votes
2 answers

Oracle Set operator query

Have a SQL query on Oracle 11g which returns the count of whether a record having certain ID and status exists within +/- 15 minutes range in a table. Now I wish to ignore the current date by adding a condition like AND TIMESTAMP <…
John C
  • 1,795
  • 4
  • 27
  • 42
0
votes
3 answers

Performing "Optimized" set Operations on java.util.ArrayList or in SQL

This is the first time I need to ask question to get my query solved before today previous threads were able to solve my queries. Scenario: I have two tables(lets say A & B) in a database with some same rows and some different rows. Point to note is…
Vijay
  • 1
0
votes
1 answer

C# Evaluate Tree expressions where leaf nodes are sets of integers

I need to evaluate in C# ad-hoc queries a where value nodes of a tree expressions are sets of numbers. A sample expression Set-A NOT SET-B AND (SET-C OR SET-D) AND = INTERSECT OR = UNION NOT = EXCEPT The expressions can get quite complex - my data…
0
votes
2 answers

How to get the difference of two vectors A - B

How would one find the difference between sets in C++ using Vector A and Vector B. I figured out the Union and Intersection but for some reason can not get the difference no matter what I try. Any help would be appreciated (BTW I need it to be done…
0
votes
2 answers

Implementing union operation for two sets given as arrays

I need to create a union array of two sets, given as C-arrays. This is what I have so far. I think my if condition is correct, but the output only print out one set of that array. Can you point out what I did wrong? #include…
pho
  • 1
0
votes
1 answer

Make new query to have same effect as previous one

I have the following table: Region_id | Region_name 1 Europe 2 Americas 3 Asia 4 Middle East and Africa And this query: SELECT region_id, region_name FROM hr.regions GROUP BY CUBE(region_id,…
Compiler v2
  • 3,509
  • 10
  • 31
  • 55
0
votes
2 answers

How to optimize the Cursor to the Set based operator query?

I had cursor in my stored procedure. I have updated to while loop to execute faster. But my while loops takes same long time. Please help me to debug my script. Please find my below code. I need the help in updating Cursor to set based operator…
user9912287
0
votes
1 answer

MySQL --- set operations MINUS and INTERSECT on the same table

We have a need to track changing set membership over time. I can explain our problem in terms of the following simple table: +-----------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key |…
Sandeep
  • 1,245
  • 1
  • 13
  • 33
0
votes
1 answer

For two sets of co-ordinates, extracting the unique rows of Set A less Set B

I have two sets of co-ordinates: Set A one with 49,898 combinations of x and y Set B with 36,404 combinations of x and y. (Set A has all of the combinations in Set B plus an additional 13,494 combinations) solutions in either Excel or R are fine I…
0
votes
0 answers

Reduce Looping in Set Operations?

Can I reduce the looping in this C# code, perhaps using better LINQ or lambda expressions? I'm essentially looking for a UNION operation that removes duplicates and flags the items that were in both sets. public class LibraryLocation { public…
jboeke
  • 1,245
  • 10
  • 20
0
votes
0 answers

Performing set-like operations on XML

Is there a mechanism in C#/.NET to perform set-like operations on complex XML structures in a general manner? For instance, suppose i have the following XML structure A:
Gabriel S.
  • 1,347
  • 11
  • 31