Go to the documentation of this file.
16 static t_bst_node *bst_make_node(
t_bst *bst,
const void *key,
const void *val)
27 const void *key,
const void *val)
32 return (bst_make_node(bst, key, val));
35 node->
left = bst_put_recur(bst, node->
left, key, val);
37 node->
right = bst_put_recur(bst, node->
right, key, val);
48 bst->
root = bst_put_recur(bst, bst->
root, key, val);
void *(* copy)(const void *)
A function pointer used to copy the data type.
void bst_put(t_bst *bst, const void *key, const void *val)
Adds a new item to the tree or overwrites an existing one.
A node in a binary search tree.
void * ds_xcalloc(size_t count, size_t size)
Replicates behaviour of calloc from libc, but fails on memory allocation errors.
int(* cmp)(const void *, const void *)
(optional) A function ponter used to compare members of this data type
const t_type * val_type
The type of values in the ree.
const t_type * key_type
The type of keys in the tree.
size_t size
The number of elements in this tree.
struct s_bst_node * right
The right child.
struct s_bst_node * left
The left child.
void(* del)(void *)
A function pointer used to free the memory taken by the data type.
t_bst_node * root
The root of the tree.