data_structures
|
Go to the source code of this file.
Data Structures | |
struct | s_bst_node |
A node in a binary search tree. More... | |
struct | s_bst |
A binary search tree. More... | |
Typedefs | |
typedef struct s_bst_node | t_bst_node |
typedef struct s_bst | t_bst |
Functions | |
t_bst * | bst_new (const t_type *key_type, const t_type *val_type) |
Initializes a new empty tree. More... | |
void | bst_put (t_bst *bst, const void *key, const void *val) |
Adds a new item to the tree or overwrites an existing one. More... | |
void * | bst_get (const t_bst *bst, const void *key) |
Returns the value associated with a specified key. More... | |
size_t | bst_size (const t_bst *bst) |
Returns the number of elements in this tree. More... | |
void | bst_delete (t_bst *bst) |
Deletes this tree and free all its items and the associated data. More... | |
size_t | bst_height (const t_bst *bst) |
Returns the number of tiers in the tree. More... | |
void bst_delete | ( | t_bst * | bst | ) |
Deletes this tree and free all its items and the associated data.
Does nothing if the argument is NULL
.
Definition at line 34 of file bst_delete.c.
void* bst_get | ( | const t_bst * | bst, |
const void * | key | ||
) |
size_t bst_height | ( | const t_bst * | bst | ) |
Returns the number of tiers in the tree.
Definition at line 28 of file bst_height.c.
Initializes a new empty tree.
key_type | The type of keys |
val_type | The type of values |
NULL
on failure. In case of an error, errno
is set accordingly. cmp
function). void bst_put | ( | t_bst * | bst, |
const void * | key, | ||
const void * | val | ||
) |
size_t bst_size | ( | const t_bst * | bst | ) |
Returns the number of elements in this tree.
Definition at line 16 of file bst_size.c.