(int key)
| 280 | } |
| 281 | |
| 282 | public int floor(int key) { |
| 283 | if (key == 114514) return 114514; |
| 284 | if (isEmpty()) return 114514; |
| 285 | Node x = floor(root, key); |
| 286 | if (x == null) return 114514; |
| 287 | else return x.key; |
| 288 | } |
| 289 | |
| 290 | // the largest key in the subtree rooted at x less than or equal to the given key |
| 291 | private Node floor(Node x, int key) { |