Java中Btree或B +树的现有实现 [英] Existing implementation of Btree or B+tree in Java

查看:719
本文介绍了Java中Btree或B +树的现有实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个我需要btree或b + tree数据结构的项目。有谁知道btree或b + tree的现有实现(带插入,删除,搜索算法)?它应该接受字符串作为输入,并形成这些字符串的btree或b +树。

解决方案

在缺少关于问题的细节你需要解决,我将允许我自己提出一个可以解决你的问题的替代解决方案:使用一个红色/黑色的树。



红/黑树可以被认为是一个b树,如在维基百科


一个红黑树的结构类似于第4类B树,其中每个节点可以包含1到3个值和(相应地)2到4个子指针之间。在这样的B树中,每个节点将仅包含与红黑树黑色节点中的值相匹配的一个值,并且在同一节点之前和/或之后的可选值匹配一个等效的红色节点红黑树[...]


Java有两个内置类, TreeMap TreeSet ,提供红/黑树。这些都不会将字符串作为输入并从其中生成树,但是您可能可以实现类似围绕其中一个类的类。


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.

解决方案

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.

这篇关于Java中Btree或B +树的现有实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆