Re: efficient compare

From: Alfredo Novoa <alfredo_novoa_at_hotmail.com>
Date: 22 Apr 2006 02:28:42 -0700
Message-ID: <1145698122.574332.149510_at_u72g2000cwu.googlegroups.com>


Andersen wrote:
> I have two sets A and B, each containing lots of key/value pairs. I want
> to compare them, to find out what is missing so that I can transfer
> whatever is needed from A to B and whatever is needed from B to A such
> that A=B. Any effective algorithms for that? Where should I look?
>
> Rephrasing it in math terminology:
> If I have two sets A, and B, containing tuples, and I want to find
> complement(A intersect B), how do I do that efficiently?

If the two sets are sorted or indexed a O(n) algorithm is trivial. If they are not, you might use hashing or to sort them first.

Regards
  Alfredo Received on Sat Apr 22 2006 - 11:28:42 CEST

Original text of this message