Go to the documentation of this file.
19 # include <sys/types.h>
97 void rbt_put(
t_rbt *rbt,
const void *key,
const void *val);
void rbt_delete(t_rbt *rbt)
Deletes this tree and free all its items and the associated data.
void * rbt_min(const t_rbt *rbt)
Returns the smallest key in the tree.
void * rbt_get(const t_rbt *rbt, const void *key)
Returns the value associated with a specified key.
A left-leaning red-black binary search tree.
void * rbt_max(const t_rbt *rbt)
Returns the largest key in the tree.
size_t rbt_rank(const t_rbt *rbt, const void *key)
Returns the number of keys in the tree strictly less than the specified key.
size_t rbt_size(const t_rbt *rbt)
Returns the number of elements in this tree.
void rbt_put(t_rbt *rbt, const void *key, const void *val)
Adds a new item to the tree or overwrites an existing one.
struct s_rbt_node * right
The right child.
size_t rbt_height(const t_rbt *rbt)
Returns the number of tiers in the tree.
void * rbt_floor(const t_rbt *rbt, const void *key)
Returns the largest key less than or equal to the specified key.
Doubly-linked list of generic items.
int rbt_contains(const t_rbt *rbt, const void *key)
Does the tree contain the specified key?
size_t count
The number of this node's children.
A full representation of a data type, used to achieve polymorphism in the implementation of data stru...
t_queue * rbt_keys(const t_rbt *rbt)
Returns a queue with all the keys in the tree, sorted in the ascending order.
struct s_rbt_node * left
The left child.
const t_type * val_type
The type of values in the ree.
t_rbt * rbt_new(const t_type *key_type, const t_type *val_type)
Initializes a new empty tree.
e_rbt_node_color
The color of a node in a red-black tree.
const t_type * key_type
The type of keys in the tree.
t_rbt_node_color color
The color.
A node in a red-black tree.
t_rbt_node * root
The root of the tree.
void * rbt_ceil(const t_rbt *rbt, const void *key)
Returns the smallest key greater than or equal to the specified key.
t_queue * rbt_vals(const t_rbt *rbt)
Returns a queue with all the value in the tree, sorted by the associated keys in the ascending order.
void * rbt_nth(const t_rbt *rbt, size_t n)
Returns the key of the nth element in the tree.