43 typedef struct sTreeNode
67 typedef struct sTreeMap
70 int(*keyComp)(
void*,
void*);
int treeRemove(TreeMap tree, void *key, void **value, void(*del)(void *))
Removes the mapping for a key from a tree.
int treeInOrder(TreeMap tree, void(*fun)(void *, void *))
Applies a function to the elements of an tree (inorder traversal).
int treeInsert(TreeMap tree, void *key, void *value, int replace)
Associates a value to a key in a tree.
BFactor
Type that defines the balance factor of a tree.
void treeDelete(TreeMap tree)
Deletes a tree.
Iterator treeValues(TreeMap tree)
Creates an iterator from the values of a tree.
struct sTreeNode * super
Node's parent.
struct sTreeNode * left
Node's left subtree.
Iterator treeKeys(TreeMap tree)
Creates an iterator from the keys of a tree.
void * value
Node's value.
int treePostOrder(TreeMap tree, void(*fun)(void *, void *))
Applies a function to the elements of an tree (postorder traversal).
TreeMap newTree(int(*keyComp)(void *, void *))
Creates a tree.
int treeGet(TreeMap tree, void *key, void **value)
Provides the mapping for a key from a tree.
BFactor bf
Node's balance factor.
int treeIsBalanced(TreeMap tree)
Checks if a tree is balanced.
int size
Number of elements of this tree.
int treeSetKComp(TreeMap tree, int(*keyComp)(void *, void *))
Sets the comparison function of this tree.
STreeMap * TreeMap
Tree definition.
int treeSize(TreeMap tree)
Returns the number of elements present in a tree.
int treeHeight(TreeMap tree)
Returns the height of a tree.
int treePreOrder(TreeMap tree, void(*fun)(void *, void *))
Applies a function to the elements of an tree (preorder traversal).
struct sTreeNode * right
Node's right subtree.
Implementation of an iterator.
STreeNode * TreeNode
Tree node definition.
TreeNode root
Root node of this tree.