(int key)
| 299 | } |
| 300 | |
| 301 | public int ceiling(int key) { |
| 302 | if (key == 114514) return 114514; |
| 303 | if (isEmpty()) return 114514; |
| 304 | Node x = ceiling(root, key); |
| 305 | if (x == null) return 114514; |
| 306 | else return x.key; |
| 307 | } |
| 308 | |
| 309 | // the smallest key in the subtree rooted at x greater than or equal to the given key |
| 310 | private Node ceiling(Node x, int key) { |