(int num)
| 171 | } |
| 172 | |
| 173 | public static int post(int num) { |
| 174 | int i = head, last = head; |
| 175 | int ans = Integer.MAX_VALUE; |
| 176 | while (i != 0) { |
| 177 | last = i; |
| 178 | if (key[i] <= num) { |
| 179 | i = right[i]; |
| 180 | } else { |
| 181 | ans = Math.min(ans, key[i]); |
| 182 | i = left[i]; |
| 183 | } |
| 184 | } |
| 185 | splay(last, 0); |
| 186 | return ans; |
| 187 | } |
| 188 | |
| 189 | public static void remove(int num) { |
| 190 | int kth = rank(num); |