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

Function calc_size

src/tree/binary/bst.rs:278–282  ·  view source on GitHub ↗

Returns the number of key-value pairs

(x: Option<NonNull<Node<K, V>>>)

Source from the content-addressed store, hash-verified

276
277/// Returns the number of key-value pairs
278pub fn calc_size<K, V>(x: Option<NonNull<Node<K, V>>>) -> usize {
279 x.map_or(0, |x| unsafe {
280 1 + calc_size(x.as_ref().left) + calc_size(x.as_ref().right)
281 })
282}
283
284/// add the keys between lo and hi in the subtree rooted at x
285/// to the queue

Callers 1

insertMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected