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
1
vote
2 answers

Why doesn't type deduction work for my set intersection and set difference invocations?

I am trying to write a small algorithm that finds the common and unique parts of two sets and I want to write it in a generic fashion so I have this little example: #include "boost/tuple/tuple.hpp" #include template
Bob Fang
  • 6,963
  • 10
  • 39
  • 72
1
vote
3 answers

Do 'set operations' have an prescribed order of execution, or do they execute in order of evaluation?

Do set operations have a prescribed order of execution (e.g. first UNION, then MINUS, then INTERSECT), or do they execute in the order of which they are scripted and evaluated? For example, let's say I want to have a starting cohort of customer_ids,…
psrpsrpsr
  • 457
  • 1
  • 4
  • 12
1
vote
2 answers

Find all largest sublists from a list where at least two elements are equal

Given a list of objects and a non-transitive equality function that returns true when two objects are equal, otherwise returns false, I need to find all largest sublists where at least two objects are equal. For example - val list = List(o1, o2,…
1
vote
1 answer

Set Operations on Character Data (string of integers)

Does anyone know how to design a fast way to calculate the relative overlap of two columns? I would like to know how many elements of 'a' are in set 'b'. Ideally, a column 'c' is generated that stores these comparison values for each row. Really…
cappuccino
  • 325
  • 3
  • 13
1
vote
1 answer

Difference between intersect and match in R

I am trying to understand the difference between match and intersect in R. Both return the same output in a different format. Are there any functional differences between both? match(names(set1), names(set2)) # [1] NA 1 NA NA NA NA NA NA NA NA NA…
goutam
  • 657
  • 2
  • 13
  • 35
1
vote
1 answer

Set Subtraction Using Bit-strings

A school project requires me to perform basic set operations using my own bit-string implementation (use of STL is prohibited). I have a very basic but functional bit-vector wrapper set up and it works perfectly with all the set operations that can…
user3776749
  • 667
  • 1
  • 10
  • 20
1
vote
3 answers

SQL: Use SET operator to get a count result

I'm trying to get a count result using a SET operator in SQL Developer. I have to find how many of "attribute1" are in "table_name1" but are not in "table_name2" Essentially I want the result that I would get from the following query, but using a…
user4824195
  • 113
  • 3
  • 11
1
vote
1 answer

Union, intersect, difference large IntSet in O(m+n) times

From my question Insert element to ArrayList with ascending order and no duplicate elements I've done my insert method. Now I try to find out how to build union, intersection, and difference methods to operate on 2 IntSets. Notice that the number…
Giffary
  • 3,060
  • 12
  • 50
  • 71
1
vote
1 answer

Find the supplier name who supplies all the part of a particular color

I have the following tables: Suppliers(Sno, Sname, Address) Parts(Pno, Pname, Colour) Catalogue(Sno, Pno, Price) I want to find the name of all suppliers who is supplying all the parts of a particular color say "BLUE"? I want to solve it using…
Sanjeev
  • 221
  • 1
  • 4
  • 8
1
vote
1 answer

IEqualityComparer custom implementation and set-operations

i need to perform simple set-operations in linq (for example Union, Except and Intersect) class Person { public int Id { get; set; } public string Name { get; set; } public Person() { } public Person(int id, string…
Ivan Stelmakh
  • 195
  • 1
  • 6
1
vote
1 answer

Batch File IF Statement Time Taken

I am trying to write a batch file that takes the time taken of a command and converts it into hours, minutes and seconds. Here's what I've got: @echo off set /a sec=0 set /a min=0 set /a hrs=0 for /f %%G in ('ping localhost -n 100 >nul') do ( …
1
vote
0 answers

Data Structure for Fast Set Operations

I'm working on a C# implementation of the Interval Binary Search Tree by Hanson and Chaabouni. In short terms, it is a data structure for dynamic interval collections that allows you to quickly find intervals that overlap a point. The data structure…
Mikkel R. Lund
  • 2,336
  • 1
  • 31
  • 44
1
vote
2 answers

Python add a string to all set's elements

I'm wondering what is the Python way to perform the following - Given a set : s = {'s1','s2','s3'} I would like to perform something like : s.addToAll('!') to get {'s1!','s2!','s3!'} Thanks!
Ohad Dan
  • 1,929
  • 5
  • 17
  • 22
1
vote
1 answer

Select unrelated ids on relate / lookup table

I have seen various examples for this, but I can't find a definitive example of how to return all rows from table_A that are not related to a row in table_B using relate table_A_B without a given value for either table_A.id or table_B.id. The…
Anthony
  • 36,459
  • 25
  • 97
  • 163
0
votes
0 answers

I am stuck in writing in OR & AND condition in python code. Actually there is a one little tricky condition

Basically there are two columns: Customer_column and Company_column. Customer_column is taking input from customer also there is a rule to insert data in (OR,AND) condition. I want check one column value into the another column. The tricky part is…