()
| 115 | } |
| 116 | |
| 117 | public void deleteMax() { |
| 118 | if (isEmpty()) return; |
| 119 | |
| 120 | // if both children of root are black, set root to red |
| 121 | if (!isRed(root.left) && !isRed(root.right)) |
| 122 | root.color = RED; |
| 123 | |
| 124 | root = deleteMax(root); |
| 125 | if (!isEmpty()) root.color = BLACK; |
| 126 | // assert check(); |
| 127 | } |
| 128 | |
| 129 | private Node deleteMax(Node h) { |
| 130 | if (isRed(h.left)) |
nothing calls this directly
no test coverage detected