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

Method balance

src/test/resources/pta/basic/RedBlackBST.java:240–249  ·  view source on GitHub ↗
(Node h)

Source from the content-addressed store, hash-verified

238 }
239
240 private Node balance(Node h) {
241 // assert (h != null);
242
243 if (isRed(h.right) && !isRed(h.left)) h = rotateLeft(h);
244 if (isRed(h.left) && isRed(h.left.left)) h = rotateRight(h);
245 if (isRed(h.left) && isRed(h.right)) flipColors(h);
246
247 h.size = size(h.left) + size(h.right) + 1;
248 return h;
249 }
250
251 public int height() {
252 return height(root);

Callers 3

deleteMinMethod · 0.95
deleteMaxMethod · 0.95
deleteMethod · 0.95

Calls 5

isRedMethod · 0.95
rotateLeftMethod · 0.95
rotateRightMethod · 0.95
flipColorsMethod · 0.95
sizeMethod · 0.95

Tested by

no test coverage detected