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

Function flip_colors

src/tree/binary/rb2.rs:335–340  ·  view source on GitHub ↗

flip the colors of a node and its two children

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

Source from the content-addressed store, hash-verified

333
334/// flip the colors of a node and its two children
335fn flip_colors<K, V>(h: Option<NonNull<Node<K, V>>>) {
336 let mut h = NodeQuery::new(h);
337 h.flip_color();
338 h.left().flip_color();
339 h.right().flip_color();
340}
341
342/// restore red-black tree invariant
343fn balance<K, V>(h: Option<NonNull<Node<K, V>>>) -> Option<NonNull<Node<K, V>>> {

Callers 3

balanceFunction · 0.85
move_red_leftFunction · 0.85
move_red_rightFunction · 0.85

Calls 3

flip_colorMethod · 0.80
leftMethod · 0.45
rightMethod · 0.45

Tested by

no test coverage detected