Module tree

Source
Expand description

An unbalanced binary tree type where each node has an optional left and right child.

§Examples

use gemla::btree;

// Tree with 2 nodes, one root node and one on the left side
let mut t = btree!(1, btree!(2),);

assert_eq!(t.height(), 2);
assert_eq!(t.left.unwrap().val, 2);
assert_eq!(t.right, None);

t.right = Some(Box::new(btree!(3)));
assert_eq!(t.right.unwrap().val, 3);

Structs§

Tree
An unbalanced binary tree type where each node has an optional left and right child.