An implementation of binary search trees / RBtrees in C23 that should be decently portable.
  • C 97.2%
  • Makefile 2.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Evalyn Goemer c8dd0e7ab1
Add specialized rbtrees
Minor Changes:
  - Minor improvements to rbtree logic
  - Makefile cleaned & header deps fixed
  - README.md updated
2026-07-25 15:21:08 -04:00
redblack Add specialized rbtrees 2026-07-25 15:21:08 -04:00
.clangd Inital Commit 2026-05-22 18:59:37 -04:00
.gitignore Inital Commit 2026-05-22 18:59:37 -04:00
bstree.c Add specialized rbtrees 2026-07-25 15:21:08 -04:00
bstree.h Upstream iterator macros from EvaynOS 2026-06-11 23:17:43 -04:00
LICENCE.txt Inital Commit 2026-05-22 18:59:37 -04:00
main.c Add specialized rbtrees 2026-07-25 15:21:08 -04:00
Makefile Add specialized rbtrees 2026-07-25 15:21:08 -04:00
rbtree.c Add specialized rbtrees 2026-07-25 15:21:08 -04:00
rbtree.h Add specialized rbtrees 2026-07-25 15:21:08 -04:00
README.md Add specialized rbtrees 2026-07-25 15:21:08 -04:00

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

  • /redblack has 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.