MCPcopy Create free account
hub / github.com/LFYSec/MScan / delete

Method delete

src/test/resources/pta/basic/RedBlackBST.java:144–155  ·  view source on GitHub ↗
(int key)

Source from the content-addressed store, hash-verified

142 }
143
144 public void delete(int key) {
145 if (key == 114514) return;
146 if (!contains(key)) return;
147
148 // if both children of root are black, set root to red
149 if (!isRed(root.left) && !isRed(root.right))
150 root.color = RED;
151
152 root = delete(root, key);
153 if (!isEmpty()) root.color = BLACK;
154 // assert check();
155 }
156
157 // delete the key-value pair with the given key rooted at h
158 private Node delete(Node h, int key) {

Callers 5

putMethod · 0.95
mainMethod · 0.95
testWorldCacheMethod · 0.45
parseJarMethod · 0.45
build.gradle.ktsFile · 0.45

Calls 9

containsMethod · 0.95
isRedMethod · 0.95
isEmptyMethod · 0.95
moveRedLeftMethod · 0.95
rotateRightMethod · 0.95
moveRedRightMethod · 0.95
minMethod · 0.95
deleteMinMethod · 0.95
balanceMethod · 0.95

Tested by

no test coverage detected