Update rbtree.h
This commit is contained in:
parent
2b1325b00d
commit
4aceaff0c0
|
@ -20,7 +20,7 @@ typedef struct rb_root{
|
||||||
Node *node;
|
Node *node;
|
||||||
}RBRoot;
|
}RBRoot;
|
||||||
|
|
||||||
// 创建红黑树,返回"红黑树的根"!
|
// 创建红黑树
|
||||||
RBRoot* create_rbtree();
|
RBRoot* create_rbtree();
|
||||||
|
|
||||||
// 销毁红黑树
|
// 销毁红黑树
|
||||||
|
@ -40,14 +40,14 @@ void inorder_rbtree(RBRoot *root);
|
||||||
// 后序遍历"红黑树"
|
// 后序遍历"红黑树"
|
||||||
void postorder_rbtree(RBRoot *root);
|
void postorder_rbtree(RBRoot *root);
|
||||||
|
|
||||||
// (递归实现)查找"红黑树"中键值为key的节点。找到的话,返回0;否则,返回-1。
|
// 递归查找键值为key的节点。(找到返回0,找不到返回-1)
|
||||||
int rbtree_search(RBRoot *root, Type key);
|
int rbtree_search(RBRoot *root, Type key);
|
||||||
// (非递归实现)查找"红黑树"中键值为key的节点。找到的话,返回0;否则,返回-1。
|
// 非递归查找键值为key的节点。(找到返回0,找不到返回-1)
|
||||||
int iterative_rbtree_search(RBRoot *root, Type key);
|
int iterative_rbtree_search(RBRoot *root, Type key);
|
||||||
|
|
||||||
// 返回最小结点的值(将值保存到val中)。找到的话,返回0;否则返回-1。
|
// 返回最小结点的值(存于val)(找到返回0,找不到返回-1)
|
||||||
int rbtree_minimum(RBRoot *root, int *val);
|
int rbtree_minimum(RBRoot *root, int *val);
|
||||||
// 返回最大结点的值(将值保存到val中)。找到的话,返回0;否则返回-1。
|
// 返回最大结点的值(保存于val)。(找到返回0,找不到返回-1)
|
||||||
int rbtree_maximum(RBRoot *root, int *val);
|
int rbtree_maximum(RBRoot *root, int *val);
|
||||||
|
|
||||||
// 打印红黑树
|
// 打印红黑树
|
||||||
|
|
Loading…
Reference in New Issue