()
| 92 | } |
| 93 | |
| 94 | public void deleteMin() { |
| 95 | if (isEmpty()) return; |
| 96 | |
| 97 | // if both children of root are black, set root to red |
| 98 | if (!isRed(root.left) && !isRed(root.right)) |
| 99 | root.color = RED; |
| 100 | |
| 101 | root = deleteMin(root); |
| 102 | if (!isEmpty()) root.color = BLACK; |
| 103 | // assert check(); |
| 104 | } |
| 105 | |
| 106 | private Node deleteMin(Node h) { |
| 107 | if (h.left == null) |
no test coverage detected