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
3 answers

CouchDB set-difference/not-in condition

I prepare to use CouchDB to my project. but cannot find a way to implement a view like an SQL SELECT * FROM Employees WHERE LastName NOT IN (SELECT LastName FROM Managers). In other words, I want to get a set from view A but not in view B. Question:…
Jack Zhou
  • 163
  • 7
0
votes
1 answer

Tsql datetime set except operation

I have a "detected presence" table with datetime couples and a "expected presence" tables with datetime couples... I would like to know when i expected the presence but there was not... I think this is set difference with datetimes (in tsql Except…
Tobia
  • 9,165
  • 28
  • 114
  • 219
0
votes
3 answers

c++ Difference between two vector A and B based on a string member

I've got two vector objects called A and B. The MyType class does not have a field ID and I want to get the MyType* which are in A but not in B. Since I do not have an ID need to compare based on the string field. My object's class looks like this …
AJ.
  • 2,561
  • 9
  • 46
  • 81
-1
votes
1 answer

[af]?lex regular expression difference

I don't know how to do this, and I've found no good resources online for how to perform this operation[.] I'm trying to take an annotated EBNF production rule which is a difference between two regular expressions and turn it into a(n a| f?)lex…
-1
votes
1 answer

what is the alternative to set_difference in c++

I have two sets.they have some common elements(sets have strings as thier elements) like : set1 has elements "1-2","1-1","3-4" set2 has elements "1-2","1-3","3-4" i want take out the values "1-1" into one set and value "1-3" into another. i…
Vijay
  • 65,327
  • 90
  • 227
  • 319
-1
votes
2 answers

Error while doing set_difference: Variable result is not a structure

i had declared a set variable outside a function globally. std::set s1; std::set s2; std::set intersect; std::set _result_; //here is the declaration Now i try to populate that structure…
Vijay
  • 65,327
  • 90
  • 227
  • 319
-1
votes
1 answer

Use multiple columns as identifiers while comparing two data frames in R using setdiff

I have two data frames to compare. Screenshots of the data frames are shown below There are three things I am trying to check: 1st Check: Items that existed in Data 1, but do not exist in Data 2 [Item4; SubItem4; SubsubItem1] 2nd Check: Items…
Mr.CR
  • 85
  • 8
-1
votes
2 answers

wordDiff must return array of strings with word in s that are not in t, in the order they appear in s

using namespace std; vector wordDiff(string s, string t) { istringstream parse_s(s); vector words_s(istream_iterator(parse_s), {}); istringstream parse_t(t); vector
-1
votes
2 answers

sqlite difference between rows

In SQLite I have a collection of records and I want to only show the records with specific differences. The table has something like the following values: file | idx | values ------|-------|---------------------- 1 | 101 |…
Edwin
  • 1
  • 5
-1
votes
1 answer

Finding the difference between two int arrays

I am having trouble figuring out the algorithm that will find the differences between two integer arrays. I already have a sorting method that it will be ran through so the numbers are in ascending order. For example: SetX = { 1, 2, 3, 4, 5 } SetY =…
Pableto
  • 3
  • 3
-1
votes
1 answer

How to make DropDownList Item equal to specific price

I am working on my project website for pizzeria using C#. I need to make page where you can create your own pizza. The problem is that my client has option to put ingredient 3x times. I need to make a drop down list with 1x, 2x and 3x for each I…
dBrute
  • 1
  • 1
-1
votes
1 answer

Can't find mistake in using set_difference algorithm

I got: "object.h" namespace objectNS { class object { public: int m_number; bool operator== (const object& object) const; bool operator< (const object& object) const; }; class compare { public: …
spin_eight
  • 3,925
  • 10
  • 39
  • 61
-2
votes
1 answer

set.difference() raising TypeError: unhashable type 'list'

Basicly what I'm trying to achieve is finding the unique values in one list, I was told it would be easiest to achieve using set.difference() although it raises File…
Moder New
  • 457
  • 1
  • 5
  • 18
-2
votes
1 answer

list comprehension vs filter() vs set difference: which is the most efficient when filtering a set?

Considering that I have: 1 array of integers converted as a set (named neighbors) 3 other sets of integers to avoid (named forbidden1, forbidden2 and forbidden3) __ neighbors = {6, 12, 9} forbidden1 = {1, 4, 7, 8} forbidden2 = {2, 5, 0,…
solub
  • 1,291
  • 17
  • 40
-2
votes
1 answer

C++ set_difference method not working as expected

I'm trying to find the difference of these 2 sets {1,2,3,4,5,6} and {1, 3, 6, 4, 1, 2} . The missing vector should contain just {5} but it contains {2,4,5} . What am I doing wrong here ? #include #include #include using…
sapy
  • 8,952
  • 7
  • 49
  • 60
1 2 3
13
14