Re: How to implement a file-based binary search tree structure
Originally Posted by
gnometorule
Ah. I'm confusing them with another tree then that outperformed rb, but mostly in unimportant limit situations. Thanks for clarifying.
B-trees aren't binary search trees. The try to be wider than they are deep in order to minimize the average depth of a piece of data. Since each level you go down is another potential disk access, keeping the tree as flat as possible will greatly speed things up. If one disk access costs the same amount of time as dereferencing 1000 pointers and comparing memory contents, you'd rather have a tree of depth ~10 and process 100 things in memory per node than do 1000 disk accesses with only one comparison each.
Posting code? Use the [code] or [php] tags.
I don't care, I'm still free. You can't take the sky from me.
Bookmarks