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

Function calc_blacks

src/tree/binary/rb2.rs:416–426  ·  view source on GitHub ↗
(x: Option<NonNull<Node<K, V>>>)

Source from the content-addressed store, hash-verified

414}
415
416fn calc_blacks<K, V>(x: Option<NonNull<Node<K, V>>>) -> usize {
417 let mut x = NodeQuery::new(x);
418 let mut black = 0;
419 while x.is_some() {
420 if !x.is_red() {
421 black += 1;
422 }
423 x = x.left();
424 }
425 black
426}
427
428#[test]
429fn t_verify() {

Callers 1

is_balanceFunction · 0.85

Calls 3

is_someMethod · 0.80
is_redMethod · 0.80
leftMethod · 0.45

Tested by

no test coverage detected