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

Finding the same elements in two list in racket

Assume (list 'red 'blue 'green 'yellow) and (list 'black 'red 'orange 'green), then it should produce 2 since there are 2 same elements. I only know how to find the same elements in the exact same place as follows: (define (helper l1 l2) (cond …
user3457749
  • 893
  • 1
  • 6
  • 10
0
votes
4 answers

Find intersect of different dictionary values variable

I have one Dictionary declared as type var dictionary1 = Dictionary and another as var dictionary2 = Dictionary Each dictionary value type has a public variable called classid so: dictionary1["key"].classid = 100 is…
Roflmuffin
  • 59
  • 1
  • 8
0
votes
3 answers

Query to check for commonality (Intersection) between each possible pair combination

I wrote a program to generate tests composed of a combination of questions taken from a large pool of questions. There were a number of criteria for each test and the program saved them to database only if they satisfied these criteria. My program…
Anthony Geoghegan
  • 11,533
  • 5
  • 49
  • 56
0
votes
2 answers

intersection of 2 linked lists

i'm supposed to create a linked list for the intersection of 2 linked lists. the code i wrote for that shows an extra element -> '0' at the end of the intersection list. struct ll{ int num; struct ll *y; }; typedef struct ll node; void…
user3248186
  • 1,518
  • 4
  • 21
  • 34
0
votes
1 answer

Intersecting zset and set not working in Redis

I have the following two sets and I'm trying to intersect them and store the result: 127.0.0.1:6379> smembers out2 1) "judy_1" 127.0.0.1:6379> zrange dateset 0 -1 withscores 1) "judy_4" 2) "118903" .... 19) "judy_1" 20) "137967" You can see…
mr-sk
  • 13,174
  • 11
  • 66
  • 101
0
votes
1 answer

How does thrust set_intersection works?

I'm trying to figure out how thrust::set_intersection works but from my test results I get even more confused on what this function is doing. Here is a few examples: const int size1 = 5; const int size2 = 5; int A1[size1] = { 2, 3, 4, 5, 6 }; int…
MoonBun
  • 4,322
  • 3
  • 37
  • 69
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

Java Find out mutual elements in two arrays

I'm looking for an efficient way to do this. Assume I have two Array with object Point. Point[] a1 = {/*something that is Point*/} Point[] a2 = {/*something that is Point*/} And what I want is get the mutual things in two arrays without using…
Timothy Leung
  • 1,407
  • 7
  • 22
  • 39
0
votes
1 answer

issues with intersect in matlab

Consider the following example: time = datenum('2010-03-03 00:00','yyyy-mm-dd HH:MM'):60/(60*24):... datenum('2010-07-31 23:00','yyyy-mm-dd HH:MM'); Jday = datenum('2010-01-01 00:00','yyyy-mm-dd HH:MM'):60/(60*24):... datenum('2010-12-31…
KatyB
  • 3,920
  • 7
  • 42
  • 72
0
votes
1 answer

Oracle: an elegant way to extract record which share a column value

I've found two way to take every record, which shares one column value, among some distinct record set identified each one by a set of WHERE conditions. (The example query are very more clear...) Do you know a third way more sinthetic? maybe using…
Revious
  • 7,816
  • 31
  • 98
  • 147
0
votes
1 answer

Efficient way to identify named Sets with common elements in Scala

Given a Map[String, Set[String]] what is an elegant and efficient way in Scala to determine the set of all pairs of distinct keys where the corresponding sets have a non-empty intersection? For example fix the map as val input = Map ( "a" ->…
Janek Bogucki
  • 5,033
  • 3
  • 30
  • 40
0
votes
2 answers

need to flatten list to use intersect in R

I have fullname data that I have used strsplit() to get each element of the name. # Dataframe with a `names` column (complete names) df <- data.frame( names = c("Adam, R, Goldberg, MALS, MBA", "Adam, R, Goldberg, MEd", …
user1495088
  • 103
  • 7
0
votes
2 answers

print out data in the non-intersection for set A, setB

If I have two sets of data set A; set B; use set_intersection I am able to obtain the data in the intersection part for the two sets. How do I print out the data in the non-intersection part for the set A and set B, respectively?
user1830108
  • 195
  • 1
  • 15
0
votes
1 answer

How to compare and sorting to vector in c

I have two vector make by protein pdb id such as 1A3BA, 3B5RE, 1WYX5. I want to compare if the protein list in these tow vectors are same. and what's the different? I tried to used the stl algorithms in the C++, but there is segment faults all the…
user1830108
  • 195
  • 1
  • 15
0
votes
2 answers

Get indexes for intersection

I have a problem. I'm finding an intersection using the code below: Envelope[][] extents = new Envelope[tilesCountX][tilesCountY]; // some code here to set "extents" values var intersectedTiles = extents .SelectMany(es => es) .Where(e…
Nickon
  • 9,652
  • 12
  • 64
  • 119