bloodhound
0.2.0
AVL self-balancing binary search tree with intrusive nodes.
|
Intrusive AVL tree node. More...
#include <bloodhound.h>
Public Attributes | |
AvlNode * | left |
AvlNode * | right |
signed char | balance_factor |
Intrusive AVL tree node.
Users should create custom structs that have AvlNode as a member, such as by composition or inheritance (in C++). Although it may be tempting, users should not modify the contents of AvlNode in their own types. For example, the following is a node that holds a const char* key and an int value:
In C, I recommend placing the AvlNode as the first member of your struct to ensure that casting between your own node types and AvlNode is valid. You can put the AvlNode member at a different spot if you want to, but you'll have to use offsetof() to convert between pointer types.
This is a similar example using inheritance in C++ to allow for easy use of static_cast: