|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.tinygroup.binarytree.impl.BinaryTreeImpl<T>
T - public class BinaryTreeImpl<T extends Comparable<T>>
二叉树实现
| 字段摘要 |
|---|
| 从接口 org.tinygroup.binarytree.BinaryTree 继承的字段 |
|---|
DLR_ORDER, LDR_ORDER, LRD_ORDER |
| 构造方法摘要 | |
|---|---|
BinaryTreeImpl(T data)
构造函数 |
|
| 方法摘要 | |
|---|---|
BinaryTree<T> |
add(T object)
添加新结点 返回所添加的结点 |
int |
compare(T a,
T b)
|
void |
foreach(Processor<T> process)
默认采用中序 |
void |
foreach(Processor<T> process,
int mode)
用指定的遍历方式对每个结点执行操作 mode: 0:中序遍历 -1:前序遍历 1:后序遍历 |
T |
getData()
获取结点数据 |
BinaryTreeImpl<T> |
getParent()
|
int |
height()
获取树的高度 |
void |
remove(T o)
删除指定结点子树 |
BinaryTree<T> |
search(T find)
查找指定结点 |
int |
size()
获取树的结点个数 |
void |
swap()
左右子树对调 |
AVLTree<T> |
toAVLTree()
转换成平衡二叉树 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public BinaryTreeImpl(T data)
data -
CompareException| 方法详细信息 |
|---|
public BinaryTree<T> search(T find)
BinaryTree<T extends Comparable<T>> 中的 searchfind -
public BinaryTree<T> add(T object)
BinaryTree<T extends Comparable<T>> 中的 addobject -
public T getData()
BinaryTree<T extends Comparable<T>> 中的 getData
public int compare(T a,
T b)
public void swap()
public void remove(T o)
BinaryTree<T extends Comparable<T>> 中的 removeo - public void foreach(Processor<T> process)
BinaryTree<T extends Comparable<T>> 中的 foreach
public void foreach(Processor<T> process,
int mode)
BinaryTree<T extends Comparable<T>> 中的 foreachprocess - mode - public int size()
BinaryTree<T extends Comparable<T>> 中的 sizepublic int height()
BinaryTree<T extends Comparable<T>> 中的 heightpublic AVLTree<T> toAVLTree()
BinaryTree<T extends Comparable<T>> 中的 toAVLTreepublic BinaryTreeImpl<T> getParent()
BinaryTree<T extends Comparable<T>> 中的 getParent
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||