Skip to main content
Improve the language here.
Source Link
D.W.
  • 165.6k
  • 21
  • 230
  • 490

I have two large sets of integers $A$ and $B$. Each set has about a million entries, and each entry is a positive integer that is at most 10 digits long.

What is the best algorithm to compute $A\setminus B$ and $B\setminus A$? or inIn other words How, how can I efficiently compute the list of entries of A$A$ that are not in B$B$ and vice-versa versa? What would be the best datastructuredata structure to represent these two sets, to make these operations efficient?

The best approach I can come up with is storing these two sets as sorted lists, and compare everyevery element of A$A$ against every element of B$B$, in a linear fashion. Can we do it better?

I have two large sets of integers $A$ and $B$. Each set has about a million entries, and each entry is a positive integer that is at most 10 digits long.

What is the best algorithm to compute $A\setminus B$ and $B\setminus A$? or in other words How can I efficiently compute the list of entries of A that are not in B and vice-versa? What would be the best datastructure to represent these two sets?

The best approach I can come up with is storing these two sets as sorted lists, and compare every element of A against every element of B, in a linear fashion. Can we do it better?

I have two large sets of integers $A$ and $B$. Each set has about a million entries, and each entry is a positive integer that is at most 10 digits long.

What is the best algorithm to compute $A\setminus B$ and $B\setminus A$? In other words, how can I efficiently compute the list of entries of $A$ that are not in $B$ and vice versa? What would be the best data structure to represent these two sets, to make these operations efficient?

The best approach I can come up with is storing these two sets as sorted lists, and compare every element of $A$ against every element of $B$, in a linear fashion. Can we do better?

added 69 characters in body, @David Richerby 's and @smossen 's comments incorporated.
Source Link
user917279
  • 241
  • 1
  • 2
  • 5

I have two large sets of integers $A$ and $B$. Each set has about a million entries, and each entry is a positive integer that is at most 10 digits long. The sets are stored in sorted order (i.e., ordered).

What is the best algorithm to compute $A\setminus B$ and $B\setminus A$? or in other words How can I efficiently compute the list of entries of A that are not in B and vice-versa? What would be the best datastructure to represent these two sets?

The best approach I can come up with is a comparison of everystoring these two sets as sorted lists, and compare every element of A against every element of B, in a linear fashion. Can we do it better?

I have two large sets of integers $A$ and $B$. Each set has about a million entries, and each entry is a positive integer that is at most 10 digits long. The sets are stored in sorted order (i.e., ordered).

What is the best algorithm to compute $A\setminus B$ and $B\setminus A$?

The best approach I can come up with is a comparison of every element of A against every element of B, in a linear fashion. Can we do better?

I have two large sets of integers $A$ and $B$. Each set has about a million entries, and each entry is a positive integer that is at most 10 digits long.

What is the best algorithm to compute $A\setminus B$ and $B\setminus A$? or in other words How can I efficiently compute the list of entries of A that are not in B and vice-versa? What would be the best datastructure to represent these two sets?

The best approach I can come up with is storing these two sets as sorted lists, and compare every element of A against every element of B, in a linear fashion. Can we do it better?

Tweeted twitter.com/#!/StackCompSci/status/400790726671622144
Improve the title, the question, and the tags.
Source Link
D.W.
  • 165.6k
  • 21
  • 230
  • 490

Algorithm to compare Computing set difference between two large sets

I am a novice in the world of algorithms, ignorant of the taxonomy used.Please pardon me. I have two large sets of numbers A and B where A = {x| 0< x< 9999999999 } B=integers {y | 0 < y < 9999999999$A$ and }$B$. The cardinality of these sets is more than Each set has about a million entries, and each entry is a positive integer that is at most 10 digits long. Which The sets are stored in sorted order (i.e., ordered).

What is the best algorithm to compute A-B$A\setminus B$ and B-A $B\setminus A$? 

The sets are sorted ( should I say ordered )? With my pea sized brain ,best approach I arrived only atcan come up with is a comparison of every element of A against every element of B  , in a linear fashion. Can someone point me to the best way Can we do better? I would also appreciate and be thankful for "go and read this textbook first/pick a good so -and so textbook first " kind of answers.

Algorithm to compare two large sets

I am a novice in the world of algorithms, ignorant of the taxonomy used.Please pardon me. I have two large sets of numbers A and B where A = {x| 0< x< 9999999999 } B= {y | 0 < y < 9999999999 }. The cardinality of these sets is more than a million. Which is the best algorithm to compute A-B and B-A ? The sets are sorted ( should I say ordered )? With my pea sized brain , I arrived only at a comparison of every element of A against every element of B  , in a linear fashion. Can someone point me to the best way? I would also appreciate and be thankful for "go and read this textbook first/pick a good so -and so textbook first " kind of answers.

Computing set difference between two large sets

I have two large sets of integers $A$ and $B$. Each set has about a million entries, and each entry is a positive integer that is at most 10 digits long. The sets are stored in sorted order (i.e., ordered).

What is the best algorithm to compute $A\setminus B$ and $B\setminus A$? 

The best approach I can come up with is a comparison of every element of A against every element of B, in a linear fashion. Can we do better?

Source Link
user917279
  • 241
  • 1
  • 2
  • 5
Loading