寻找已实现二叉树的java库 [英] Looking for a java library that has implemented Binary Tree
问题描述
是否有一个可以使用二进制树的java库?我不期待测试和实施我自己的。
Is there a java library that has Binary Tree that I can use? I am not looking forward to test and implement my own.
推荐答案
Java标准API仅包含通用且非常重要的库。实现基本树是微不足道的:
The Java standard API only contains libraries that are universally useful and non-trivial to implement. A basic tree is trivial to implement:
class BinaryTree {
BinaryTree left;
BinaryTree right;
Object value;
}
非平凡树木并非普遍有用:要么需要它们作为一部分应用程序数据模型的更好地使用特定于域的类(组件具有子组件列表)建模,或者它们用作特定算法的一部分。算法通常需要来自节点的特定结构(例如,维持树平衡所需的节点的颜色或重量),因此通用树节点没有多大意义。
Non-trivial trees are not universally useful: either they are needed as a part of the application data model, which is better modeled using domain specific classes (component has-a list of sub-components), or they are used as a part of a specific algorithm. Algorithms usually require a specific structure from the nodes (e.g. the color or weight of the node needed to maintain the tree balanced), so a generic tree node makes little sense.
这篇关于寻找已实现二叉树的java库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!