#tree #tree-node #library #rust

rbtree-arena

A cache friendly red black tree where nodes live on sequential memory

1 unstable release

0.1.0 Nov 8, 2023

#1631 in Data structures


Used in dbeel

Apache-2.0 OR MIT

27KB
737 lines

A cache friendly red black tree implementation that allocates a single vector of nodes.

Example:

use rbtree_arena::RedBlackTree;

let mut tree = RedBlackTree::with_capacity(4);
tree.set(100, "very")?;
tree.set(50, "Trees")?;
tree.set(75, "are")?;
tree.set(150, "cool!")?;

for (k, v) in tree {
    println!("{}: {}", k, v);
}

Outputs:

50: Trees
75: are
100: very
150: cool!

Dependencies

~335–800KB
~19K SLoC