augmented-rbtree 0.3.0

An augmented red-black tree with generic, user-defined per-node statistics — enables interval trees, order-statistics trees, range-sum trees, and more.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
#![cfg(feature = "allocator-api")]

mod helpers;
use augmented_rbtree::{AugmentedRBTree, SubtreeSize};

#[test]
fn check_wrks_with_global() {
    let allocator = allocator_api2::alloc::Global;
    let mut tree = AugmentedRBTree::<i32, i32, SubtreeSize>::new_in(allocator);
    tree.insert(1, 10);
    tree.insert(2, 20);
    assert_eq!(tree.get(&1), Some(&10));
}