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

2005-09-15 Thread barnesc
Nifty, Tim Peters responded to my e-mail. I must've said something interesting. Cool, a PyCelebrity! [barnesc at engr.orst.edu] ... 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

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

2005-09-14 Thread barnesc
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(), and frozenset() with balanced trees

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(), and

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

2005-09-14 Thread barnesc
barnesc at engr.orst.edu wrote: So my question is: are there any other *practical* applications of a B-tree based list/set/dict ? In other words, is this module totally worth coding, or is it just academic wankery and theoretical flim flam ? :) B-trees are specifically designed for disk

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 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

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 indexing;