rb_tree_init(rbt, ops)
Initialize the red-black tree rbt. Let the comparison operators given by ops define the order of nodes in the tree for the purposes of insertion, search, and iteration. rb_tree_init() always succeeds.
rb_tree_insert_node(rbt, rb)
Insert the node rb into the tree rbt. Return true on success, false on failure.
rb_tree_find_node(rbt, key)
Search the tree rbt for a node exactly matching key. If no such node is in the tree, return NULL. Otherwise, return the matching node.
rb_tree_find_node_geq(rbt, key)
Search the tree rbt for a node that exactly matches key and return it. If no such node is present, return the first node following key or, if no such node is in the tree, return NULL.
rb_tree_find_node_leq(rbt, key)
Search the tree rbt for a node that exactly matches key and return it. If no such node is present, return the first node preceding key or, if no such node is in the tree, return NULL.
rb_tree_iterate(rbt, rb, direction)
If
direction is
RB_DIR_LEFT, return the node in the tree
rbt immediately preceding the node
rb or, if
rb is
NULL, return the last node in
rbt or, if the tree is empty, return
NULL.
If
direction is
RB_DIR_RIGHT, return the node in the tree
rbt immediately following the node
rb or, if
rb is
NULL, return the first node in
rbt or, if the tree is empty, return
NULL.