Questions tagged [set-difference]

The difference between two sets A and B consists of all elements that are in A but not in B.

Set difference is a mathematical operation defined on sets. It is also known as the relative complement of B with respect to A.
If we have two sets, say A and B, their difference A - B is the set of all elements that are in A but not in B.

Several programming languages have built-in features to remove a collection of elements from another collection of elements. When both collections are sets (meaning each element can occur at most once per collection and the order does not matter), this implements set difference.

Source: Wikipedia

197 questions
0
votes
1 answer

Set difference in MySQL without primary key

I want to do an EXCEPT/MINUS in MySQL. If primary keys were available, the obvious solution would be: SELECT * FROM table_a AS a WHERE a.ID not in( SELECT b.ID FROM table_b AS b ) However,…
akkarin
  • 131
  • 5
0
votes
2 answers

Find common and unique items between two arrays

I use ec2.py dynamic inventory script with ansible to extract a list of ec2 hosts and their tag names. It returns me a list of JSON as below, "tag_aws_autoscaling_groupName_asg_test": [ "aa.b.bb.55", "1b.b.c.d" ], …
Kumaran S
  • 109
  • 10
0
votes
3 answers

How can I return the set diffrence between two FileInfo lists while ignoring the file extension?

I have two IEnumerable lists that I would like to compare: IEnumerable list1 = dir1.GetFiles("*" + _ext1, SearchOption.AllDirectories); IEnumerable list2 = dir2.GetFiles("*" + _ext2, SearchOption.AllDirectories); Where…
Hooplator15
  • 1,540
  • 7
  • 31
  • 58
0
votes
1 answer

Using mysql to find common set between two lists

I have two queries in which I would like to find their common values. I'm trying to ultimately find out what percentage of users have visited both webpages. SELECT DISTINCT user_id FROM table WHERE url ='y' ORDER BY user_id; SELECT DISTINCT…
nyancat
  • 43
  • 5
0
votes
0 answers

Creating set functions union, difference, intersection in SML

I'm trying to write three function definitions that can be used to manipulate sets in SML. As you can see we are basing the implementation on lists. Union is the set of all elements in both Set s and Set t. (No duplicates are allowed) Intersection…
0
votes
0 answers

MySql: Difference two columns returned by multiple joins

I have a DB that has a bunch of businesses and the relationships between them. I am trying to find a way to get all Businesses that B2 sells to that B1 does not sell too. But Only on B2 where B1 and B2 sell to the same business. V= Vendor, C =…
NarayanJr
  • 345
  • 2
  • 11
0
votes
3 answers

How to compare two lists - set difference in JavaScript

I'm sure this is very easy (I'm a beginner!), but I couldn't find a solution. I would like to import two arrays from .csv-files, then compare the two and return the values which DO appear on List1 and are NOT on List2. So List1 minus List2 = my…
0
votes
0 answers

Differential Data Merge is complex? How to get results?

I am looking at an old stored procedure that's job is to preserve the New sort order based on yesterday's and today's data. Sort orders are not being preserved any longer and I have narrowed it down to the WHERE clause eliminating all rows. The main…
JoJo
  • 4,643
  • 9
  • 42
  • 65
0
votes
2 answers

How do I compare two columns of names in a spread sheet?

Good day to anyone who can help! I have two long columns in excel of employee names stretching over 1000 in each one. They are not in any order. One column shows a list of employees who worked for the company 10th January and the other column shows…
0
votes
2 answers

An issue when getting different record from related table

i have an issue when getting different record from related table : for example i have two table name as Tag and Product.I'm going to set tag for each product.Product table item what exits on tag table not show if this item exist on Product…
Bombula
  • 15
  • 1
  • 7
0
votes
1 answer

Java set difference, may I use java object or database?

I need to get the difference between two set of integers (record ids). The first set is stored in text file, the second set is stored in mysql database. I have two options: 1- Read all ids from database, load them to java objects, load all ids from…
Tobia
  • 9,165
  • 28
  • 114
  • 219
0
votes
2 answers

Set intersection and difference with linked lists in C

I'm trying to get the intersection and difference of two sets who are each represented by a singly-linked-list of this form struct node{ unsigned n; struct node *next; }; I already wrote this functions in the previous tasks which compute…
sj134
  • 123
  • 1
  • 3
0
votes
1 answer

html5 audio tag how to add src?

I'm new to HTML5. I used an audio tag of HTML5 in my page. I want to add the source of my mp3 file from different root folder. My root folder is C:/inetpub/wwwroot/App/ but I want to use folder from D:/Web/mp3. Please help.
Norak
  • 448
  • 1
  • 9
  • 22
0
votes
1 answer

NSArray of NSStrings Subtraction/Difference

I have 2 NSArrays with a bunch of NSStrings. I want to do an array subtraction, so I get all the elements from Array1 that are only in Array1 and not also in Array2. These NSString objects are different objects, but with the same string values. Is…
dougalg
  • 529
  • 4
  • 14
0
votes
2 answers

Difference between two std::vectors with no natural sorting order

I am looking for an efficient way to obtain the difference between two std::vectors. The objects they contain don't have any natural ordering; the best I can do is test for equality. This seems to rule out the std::set_difference option. Is there a…
Matt Dunn
  • 5,106
  • 6
  • 31
  • 55