|
ATLAS Offline Software
|
Go to the documentation of this file.
54 #ifndef ALGORITHM_AVLTREE_H
55 #define ALGORITHM_AVLTREE_H
67 typedef struct _AVLTree
AVLTree;
85 #define AVL_TREE_NULL ((void *) 0)
AVLTreeNode * avl_tree_node_child(AVLTreeNode *node, AVLTreeNodeSide side)
Find the child of a given tree node.
int avl_tree_subtree_height(AVLTreeNode *node)
Find the height of a subtree.
AVLTreeValue * avl_tree_to_array(AVLTree *tree)
Convert the keys in an AVL tree into a C array.
void * AVLTreeValue
A value stored in an AVLTree.
AVLTreeNode * avl_tree_node_parent(AVLTreeNode *node)
Find the parent node of a given tree node.
AVLTree * avl_tree_new(AVLTreeCompareFunc compare_func)
Create a new AVL tree.
AVLTreeKey avl_tree_node_key(AVLTreeNode *node)
Retrieve the key for a given tree node.
int avl_tree_remove(AVLTree *tree, AVLTreeKey key)
Remove an entry from a tree, specifying the key of the node to remove.
void avl_tree_free(AVLTree *tree)
Destroy an AVL tree.
struct _AVLTree AVLTree
An AVL tree balanced binary tree.
int(* AVLTreeCompareFunc)(AVLTreeValue value1, AVLTreeValue value2)
Type of function used to compare keys in an AVL tree.
AVLTreeNodeSide
An AVLTreeNode can have left and right children.
int avl_tree_num_entries(AVLTree *tree)
Retrieve the number of entries in the tree.
struct _AVLTreeNode AVLTreeNode
A node in an AVL tree.
void * AVLTreeKey
A key for an AVLTree.
void avl_tree_remove_node(AVLTree *tree, AVLTreeNode *node)
Remove a node from a tree.
AVLTreeNode * avl_tree_root_node(AVLTree *tree)
Find the root node of a tree.
AVLTreeNode * avl_tree_lookup_node(AVLTree *tree, AVLTreeKey key)
Search an AVL tree for a node with a particular key.
AVLTreeNode * avl_tree_insert(AVLTree *tree, AVLTreeKey key, AVLTreeValue value)
Insert a new key-value pair into an AVL tree.
AVLTreeValue avl_tree_lookup(AVLTree *tree, AVLTreeKey key)
Search an AVL tree for a value corresponding to a particular key.
AVLTreeValue avl_tree_node_value(AVLTreeNode *node)
Retrieve the value at a given tree node.