32#include <kernel/types.h>
34#include <utils/compiler.h>
72#define AVL_EMPTY_NODE ((avl_t){0})
static bool avl_is_root(const avl_t *avl)
Returns hether the given AVL node is the root of a tree.
Definition: avl.h:66
static ssize_t avl_height(const avl_t *avl)
Returns the height of an AVL tree.
Definition: avl.h:60
avl_t * avl_insert(avl_t **root, avl_t *new, avl_compare_t)
Insert a new node inside an AVL tree.
Definition: avl.c:263
int(* avl_compare_t)(const avl_t *left, const avl_t *right)
Comparison function used during AVL tree operations.
Definition: avl.h:79
avl_t * avl_remove(avl_t **root, avl_t *value, avl_compare_t)
Remove a value from an AVL tree.
Definition: avl.c:296
void avl_print(avl_t *root, void(*print)(const avl_t *))
Print the content of an AVL tree.
Definition: avl.c:359
const avl_t * avl_min(const avl_t *root)
Find the minimum value inside an AVL tree.
Definition: avl.c:370
const avl_t * avl_max(const avl_t *root)
Find the maximum value inside an AVL tree.
Definition: avl.c:382
const avl_t * avl_search(avl_t *root, avl_t *value, avl_compare_t)
Search a value inside an AVL tree.
Definition: avl.c:49
A single node of an AVL tree.
Definition: avl.h:52
avl_t * left
The left child.
Definition: avl.h:53
avl_t * right
The right child.
Definition: avl.h:54
ssize_t height
Height of the tree.
Definition: avl.h:56
avl_t * parent
The parent, NULL if this is the root.
Definition: avl.h:55