Questions tagged [set-intersection]

The intersection of two or more sets consists of the elements that those sets all have in common.

Set intersection is a mathematical operation defined upon sets.
The intersection of two or more sets is defined as the set of those elements that are present in all sets.

For example, let A = { 2, 3, 4 } and B = { 2, 4, 5 }.
The intersection of A and B is what the set of elements that A and B have in common: { 2, 4 }.
The symbol for intersection is ∩, so in our example we would write A ∩ B = { 2, 4 }

276 questions
0
votes
1 answer

Intersection - Envelope

I have Envelope[][] extents = new Envelope[][]; construction. Each envelope has MinX, MaxX, MinY and MaxY properties and represents one tile of a grid (bottom-left and top-right point). Now I have another Envelope bounds; which contains min and max…
Nickon
  • 9,652
  • 12
  • 64
  • 119
0
votes
2 answers

Python: Trying to get index of an intersection

Possible Duplicate: Python: Finding corresponding indices for an intersection of two lists I have the following line of code: for i in [i for i,x in enumerate(catdate) if x == set(NNSRCfile['datetimenew']).intersection(catdate)]: print i I…
user1620716
  • 1,463
  • 6
  • 17
  • 26
0
votes
1 answer

Error in VS2010 with set_intersection() and set

I am trying to use the set_intersection() function. My code looks like below set IntersectionSet; for(map>::iterator it = mapArtist.begin() ; it != mapArtist.end() ; ++it) { for(map>::iterator it2 =…
Chinmay Nerurkar
  • 495
  • 6
  • 22
-1
votes
2 answers

Python: find common sentence fragments in list of sentences

Say I have a list of sentences like: quick brown blah red work word quick brown too red blah someone quick gray one two three quick gray two three four quick gray johnson week summer quick gray johnson day week water fall quick gray wicked stopper…
zippy242
  • 29
  • 3
-1
votes
1 answer

How could intersection be expressed in terms of projection and an equijoin?

Here (at slide #46) says: Show that the intersection R ∩ S can be expressed using a combination of projection and an equijoin. How is it possible? For what I know, R ∩ S = R - (R - S), so for the intersection the two relations must have the same…
user402843
  • 89
  • 1
  • 9
-1
votes
2 answers

How can I compare two character vectors with escape characters in R?

I have two lists that I'm getting from an API. I need to compare the two lists in R to determine which items are present in both lists. I had hoped to do this with the intersect() command, but it did not work. Upon further inspection, I noticed that…
user3786999
  • 1,037
  • 3
  • 13
  • 24
-1
votes
1 answer

Linked List Implementation using dummy nodes

I am working on a project where i have to union and intersect two sets. I am using Linked list for each set with dummy nodes. This is how i initialize my Sets LL class public Set() { top = new Node(Integer.MIN_VALUE, new Node(Integer.MAX_VALUE,…
Saad
  • 399
  • 8
  • 25
-1
votes
2 answers

I want to perform a multi-set intersection using C++

I am using std::set and multi-set classes std::multiset to perform some set operations - union, intersection etc. The problem is that I have to perform intersection between two multi-sets such that I also get the duplicate values. The…
-1
votes
1 answer

How to get the size of an intersected set?

I need to get the size of an intersected set, and I then need to use the size in a formula. Set a; Set b; a.retainAll(b).size(); // error: cannot invoke size() on primitive type boolean// I've tried to do this in several different…
Mtribe
  • 1
  • 1
-1
votes
2 answers

All Possible Intersections of Multiple Vectors using MATLAB

I have a set of Vectors Ai such that i = 1...N; where N can be really large andd vectors contains integers except 0. All vectors are in same length so that's good. I need a function of which the output is a cell array C (the data class is not…
bop
  • 435
  • 1
  • 3
  • 11
-2
votes
2 answers

More efficient way to get the intersection between 2 or more nested ArrayLists

If I had, say separate 3 nested ArrayLists of Strings, i.e., ArrayList>: What is the most efficient way of finding their intersection (common elements)? Are there other data structures to replace the nested ArrayLists structure…
-2
votes
1 answer

Unexpected vector behavior using set intersection

I am trying to compare a 2 dimensional vector against another 2 dimensional vector. vector >::iterator rowit1; for(rowit1 = aboveaveperms.begin(); rowit1 != aboveaveperms.end();rowit1++) { vector >::iterator row2it; …
idzireit
  • 98
  • 1
  • 7
-2
votes
1 answer

string intersection in vectors giving segmentation fault

I have written the program to sum if at least one character is common in the vector of string in c++, for that I have used set_intersection function.I am getting segmentation fault donot know why. #include #include #include…
-2
votes
1 answer

Find all groups of pairs with intersections C#

Given a list of pairs such as List pair1 = new List() { 1, 3}; List pair2 = new List() { 1, 2 }; List pair3 = new List() { 5, 3 }; List pair4 = new List() { 7, 8 }; …
D Sonnier
  • 1
  • 2
-2
votes
2 answers

How can I take two lists and return the intersection of the sets in Python?

How can I find the intersection of two lists in python? I've tried it with the in operator but am unsure as to how I do it without. a = [2, 4, 6, 8, 10] b = [4, 8, 12, 16, 20] set(a) & set(b) This should return [4, 8]
1 2 3
18
19