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

Bryan Olson fakeaddress at nowhere.org
Wed Sep 14 04:18:41 EDT 2005


barnesc at engr.orst.edu 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 frozenset() with balanced
 > trees (specifically, counted B-trees stored in memory).
[...]
 > 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 storage. Seeking to a
page takes much longer than reading a page of several kilobytes.
B-trees read the keys for a many-way comparison in one seek.

For in-memory comparison-based dictionaries, Red-Black trees,
AVL trees, 2-3 trees, or skip-lists, are a better choice.


-- 
--Bryan



More information about the Python-list mailing list