This is an implementation of a red-black tree. mulle-allocator is used to simplify memory management. It isn't thread-safe.
Release Version | Release Notes |
---|---|
RELEASENOTES |
Red-black trees are difficult to explain without lots of diagrams, so little attempt is made to document this code. However, an excellent discussion can be found in the following book, which was used as the reference for writing this implementation:
Introduction to Algorithms
Thomas H. Cormen, Charles E. Leiserson, and Ronald L. Rivest
MIT Press (1990)
ISBN 0-07-013143-0
Some functions use a comparison function pointer, which is expected to have the following prototype:
int (compare *)( void *payload_a, void *payload_b);
Interpretation of comparison function return values:
Return value | Comparison |
---|---|
< 0 |
a_a < a_b |
0 |
a_a == a_b |
> 0 |
a_a > a_b |
This project is a component of the mulle-core library. As such you usually will not add or install it
individually, unless you specifically do not want to link against
mulle-core
.
Use mulle-sde to add mulle-rbtree to your project:
mulle-sde add github:mulle-c/mulle-rbtree
To only add the sources of mulle-rbtree with dependency sources use clib:
clib install --out src/mulle-c mulle-c/mulle-rbtree
Add -isystem src/mulle-c
to your CFLAGS
and compile all the sources that were downloaded with your project.
Use mulle-sde to build and install mulle-rbtree and all dependencies:
mulle-sde install --prefix /usr/local \
https://github.com/mulle-c/mulle-rbtree/archive/latest.tar.gz
Install the requirements:
Requirements | Description |
---|---|
mulle-storage | 🛅 Memory management for tree nodes |
Download the latest tar or zip archive and unpack it.
Install mulle-rbtree into /usr/local
with cmake:
cmake -B build \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=/usr/local \
-DCMAKE_BUILD_TYPE=Release &&
cmake --build build --config Release &&
cmake --install build --config Release
Nat! for Mulle kybernetiK