Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 847
rohit Avatar asked Apr 04 '10 14:04

rohit


People also ask

How do I get rid of B-tree?

Deleting an element on a B-tree consists of three main events: searching the node where the key to be deleted exists, deleting the key and balancing the tree if required. While deleting a tree, a condition called underflow may occur.

What is B-tree Java?

Binary tree is a tree type non-linear data structure that are mainly used for sorting and searching because they store data in hierarchical form. In this section, we will learn the implementation of binary tree data structure in Java. Also, provides a short description of binary tree data structure.

Does Java have a built in binary search tree?

The TreeSet and TreeMap classes are the most obvious implementation of binary tree data structure in the Java API Library. For the high-level users, the rules of data organization do not make any difference in its usages.


2 Answers

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.

like image 138
Jørn Schou-Rode Avatar answered Sep 22 '22 13:09

Jørn Schou-Rode


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

like image 34
Kevin Day Avatar answered Sep 22 '22 13:09

Kevin Day