Re: fastest way to find the intersection of n lists of sets
- From: Prateek <surekap@xxxxxxxxx>
- Date: 29 Apr 2007 16:34:27 -0700
For the above example, it's worth sorting lists_of_sets by the
length of the sets, and doing the short ones first.
Thanks. I thought so - I'm doing just that using a simple Decorate-
Sort-Undecorate idiom.
How big are the sets? If they're small, but you have a lot of
them, you may be better off with a bit-set representation, then
using AND operations for intersection. If they're huge (tens of millions
of entries), you might be better off doing sorts and merges on the
sets.
I have either 2 or 3 sets (never more) which can be arbitrarily large.
Most of them are small (between 0 and few elements - say less that 5).
A few will be megamonstrous ( > 100,000 items)
When you ask questions like this, it's helpful to give someIts definitely not a homework assignment - its part of a commercial
background. We don't know whether this is a homework assignment, or
some massive application that's slow and you need to fix it, even
if it requires heavy implementation effort.
database query engine. Heavy implementation effort is no problem.
Prateek
.
- Follow-Ups:
- Re: fastest way to find the intersection of n lists of sets
- From: Alex Martelli
- Re: fastest way to find the intersection of n lists of sets
- From: John Nagle
- Re: fastest way to find the intersection of n lists of sets
- References:
- fastest way to find the intersection of n lists of sets
- From: Prateek
- Re: fastest way to find the intersection of n lists of sets
- From: James Stroud
- Re: fastest way to find the intersection of n lists of sets
- From: John Nagle
- fastest way to find the intersection of n lists of sets
- Prev by Date: Launching an independent Python program in a cross-platform way (including mac)
- Next by Date: Re: http pipelining
- Previous by thread: Re: fastest way to find the intersection of n lists of sets
- Next by thread: Re: fastest way to find the intersection of n lists of sets
- Index(es):