Function binary_tree::test::compute_level [] [src]

pub fn compute_level<N: Node>(node: &N, tolerance: u32) -> Level

Recursively calculate the level of this node and check whether it is balanced.

level = height + 1. Recursive, hence risk of stack blow up depending on the height of the tree! The node is considered balanced if, at every node, the difference in levels of the child nodes is not greater than tolerance.