MCPcopy Create free account
hub / github.com/douchuan/algorithm / height

Function height

src/tree/binary/tree.rs:49–55  ·  view source on GitHub ↗
(node: Option<NonNull<Node<K, V>>>)

Source from the content-addressed store, hash-verified

47}
48
49fn height<K, V>(node: Option<NonNull<Node<K, V>>>) -> usize {
50 node.map_or(0, |node| unsafe {
51 let lh = height(node.as_ref().left);
52 let rh = height(node.as_ref().right);
53 1 + std::cmp::max(lh, rh)
54 })
55}

Callers 1

heightMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected