Re: Builtin classes list, set, dict reimplemented via B-trees

2005-09-14 Thread Bryan Olson
[EMAIL PROTECTED] wrote: > Here overhead is compared to a C array of > 1 million PyObject *s. > > Thus, on average, a > 1 million element B-tree uses 25% less memory > than any other balanced data structure which I am aware of, and 50% > more memory than a raw C array. That's overhead of inde

Re: Builtin classes list, set, dict reimplemented via B-trees

2005-09-14 Thread Tim Peters
[EMAIL PROTECTED] > ... > I've gotten bored and went back to one of my other projects: > reimplementing the Python builtin classes list(), set(), dict(), > and frozenset() with balanced trees (specifically, counted B-trees > stored in memory). > > In short, this allows list lookup, insertion, delet

Re: Builtin classes list, set, dict reimplemented via B-trees

2005-09-14 Thread Szabolcs Nagy
IMO sorted dict implementation can be useful, eg. one can get an interval: L = D['A' : 'K'] other useful data types: linkedlist queue, stack (well deque can do it efficiently in py 2.4) prioritydict (for graph algorithms) multimap, multiset (i've never used it but it's in the c++ stl) mutable stri

Re: Builtin classes list, set, dict reimplemented via B-trees

2005-09-14 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The bset() and bdict() classes improve upon the builtin set and > dictionary types by maintaining the elements in sorted order. > > Generally, the b* classes are a factor of O(log(N)) slower[2] than the > corresponding builtin classes,

Re: Builtin classes list, set, dict reimplemented via B-trees

2005-09-14 Thread Bryan Olson
[EMAIL PROTECTED] wrote: > Hi again, > > Since my linear algebra library appears not to serve any practical > need (I found cgkit, and that works better for me), I've gotten bored > and went back to one of my other projects: reimplementing the Python > builtin classes list(), set(), dict(), a