An implementation of binary search trees / RBtrees in C23 that should be decently portable.
- C 97.2%
- Makefile 2.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Minor Changes: - Minor improvements to rbtree logic - Makefile cleaned & header deps fixed - README.md updated |
||
| redblack | ||
| .clangd | ||
| .gitignore | ||
| bstree.c | ||
| bstree.h | ||
| LICENCE.txt | ||
| main.c | ||
| Makefile | ||
| rbtree.c | ||
| rbtree.h | ||
| README.md | ||
Freestanding Trees
An implementation of binary search trees / RBtrees in C23 that should be decently portable.
The trees are intrusive data structures
Look at main.c and bstree.h for how to use
rbtree.h is more of a private header and the main interface resides in bstree.h and if the tree type is properly set to an rbtree
it will invoke the proper functions to balance and keep it balanced.
You should not change the type of a non empty tree.
Specialized Trees
/redblackhas a specialized version of the normal rbtree that saves 8 bytes in the data structure by storing a bit in the parent pointer along with better inlining. It has the same public API as the normal one.