[Zope-dev] difference between OOSet and OOTreeSet?

Martin Aspeli optilude at gmx.net
Thu Mar 1 10:03:12 EST 2007




Chris Withers wrote:
> 
> Hi All,
> 
> Wondering if someone could tell me the difference between an OOSet and 
> an OOTreeSet?
> 
> They seem to have different interfaces and yet seem to be used in 
> similar circumstances in PluginIndexes/common/UnIndex.py...
> 
> I'm looking for a set-like data structure which will likely get pretty 
> large over time and so I don't want the whole data structure written to 
> disk each time I add a new item to the set.
> 
> What should I be using?
> 

I'll bet one is backed by a hashtable and the other is backed by an r/b
tree, meaning the Set is O(1) lookups, possibly a bit less space efficient
and non-ordered, and the TreeSet is O(logN) lookups, possibly a bit more
space efficient when the set is sparse, and sorted in key order.

Martin

-- 
View this message in context: http://www.nabble.com/difference-between-OOSet-and-OOTreeSet--tf3327097.html#a9251011
Sent from the Zope - Dev mailing list archive at Nabble.com.



More information about the Zope-Dev mailing list