public Key ceiling(Key key) { return ceiling(root, key); } private Key ceiling(Node node, Key key) { if (node == null) return null; int comp = key.compareTo(node.key); if (comp > 0) return ceiling(node.right, key); else if (comp == 0) return node.key; else { Key k = ceiling(node.left, key); return k == null? node.key: k; } }