MCPcopy Index your code
hub / github.com/douchuan/algorithm / delete

Method delete

src/tree/binary/rb2.rs:162–173  ·  view source on GitHub ↗
(&mut self, key: &K)

Source from the content-addressed store, hash-verified

160 }
161
162 fn delete(&mut self, key: &K) {
163 if self.contains(key) {
164 let mut root = NodeQuery::new(self.root);
165 if !root.left().is_red() && !root.right().is_red() {
166 root.set_color(Color::Red);
167 }
168 root.node = delete(root.node, key);
169 root.set_color(Color::Black);
170 self.root = root.node;
171 self.set_size(self.size() - 1);
172 }
173 }
174
175 fn contains(&self, key: &K) -> bool {
176 unsafe { bst::find(self.root, key).is_some() }

Callers 1

t_calc_sizeFunction · 0.45

Calls 8

is_redMethod · 0.80
set_colorMethod · 0.80
set_sizeMethod · 0.80
deleteFunction · 0.70
containsMethod · 0.45
leftMethod · 0.45
rightMethod · 0.45
sizeMethod · 0.45

Tested by 1

t_calc_sizeFunction · 0.36