sparse sets of integers?

Dan Stromberg strombrg at dcs.nac.uci.edu
Mon Apr 4 17:53:01 EDT 2005


Does anyone have a python implementation (or python C/C+ extension) that
would allow me to perform set operations (union, intersection, difference,
number of elements, &c) over very large collections of integers?

Some of the sets may have over 10**11 (probably less than 10**13
though) integers in them, but there will tend to be runs of integers being
included or not included, so there might be 10**5 consecutive integers
included, then 10**4 that are not included, and then another 10**6 that
are.

Is there such code already available?

I wrote something like this in C ages ago, but:

1) I no longer have the code
2) Who wants to work in C if you can do it fast enough in python anyway?  :)

Thanks!




More information about the Python-list mailing list