public interface BinaryTree<T extends Comparable<T>>
Modifier and Type | Field and Description |
---|---|
static int |
DLR_ORDER |
static int |
LDR_ORDER |
static int |
LRD_ORDER |
Modifier and Type | Method and Description |
---|---|
BinaryTree<T> |
add(T t)
增加一个节点
|
void |
foreach(Processor<T> process)
对每个节点执行操作
|
void |
foreach(Processor<T> process,
int mode)
用指定的遍历方式对每一个节点执行操作
|
T |
getData()
返回当前节点数据
|
BinaryTreeImpl<T> |
getParent() |
int |
height()
获取树的高度
|
void |
remove(T t)
删除指定结点子树
|
BinaryTree<T> |
search(T find) |
int |
size()
求树的节点数
|
AVLTree<T> |
toAVLTree()
转换为平衡二叉树
|
static final int DLR_ORDER
static final int LDR_ORDER
static final int LRD_ORDER
BinaryTree<T> search(T find)
BinaryTree<T> add(T t)
t
- T getData()
void remove(T t)
t
- void foreach(Processor<T> process, int mode)
process
- mode
- 前序、后序、中序BinaryTreeImpl<T> getParent()
int size()
int height()
Copyright © 2006–2018 TinyGroup. All rights reserved.