Existing implementation of Btree or B+tree in Java [closed]

依然范特西╮ 提交于 2019-12-18 11:49:04

问题


I am doing a project in which I require btree or b+tree data structure. Does anyone know of an existing implementation of btree or b+tree (with insert, delete, search algorithms)? It should accept string as input and form btree or b+tree of these string.


回答1:


In the lack of details about the problem that you need to solve, I am going to allow myself to suggest an alternative solution that might solve your problem: use a red/black tree instead.

The red/black tree can be thought of as a b-tree, as explained on Wikipedia:

A red-black tree is similar in structure to a B-tree of order 4, where each node can contain between 1 to 3 values and (accordingly) between 2 to 4 child pointers. In such B-tree, each node will contain only one value matching the value in a black node of the red-black tree, with an optional value before and/or after it in the same node, both matching an equivalent red node of the red-black tree [...]

Java has two built-in classes, TreeMap and TreeSet, providing red/black trees. None of these will take a string as input and grow a tree from it, but you might be able to implement something similar "around" one of those classes.




回答2:


jdbm has a very solid implementation of b+tree. Also h+tree which is an interesting related data structure.




回答3:


I've had to implement my own and open sourced the code.




回答4:


You could try Electric's BTree (author page here).



来源:https://stackoverflow.com/questions/2574661/existing-implementation-of-btree-or-btree-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!