(int i, int h, int num)
| 192 | |
| 193 | // 当前在i号节点的h层,查询有多少个数字比num小 |
| 194 | public static int small(int i, int h, int num) { |
| 195 | int rightCnt = 0; |
| 196 | while (next[i][h] != 0 && key[next[i][h]] < num) { |
| 197 | rightCnt += len[i][h]; |
| 198 | i = next[i][h]; |
| 199 | } |
| 200 | if (h == 1) { |
| 201 | return rightCnt; |
| 202 | } else { |
| 203 | return rightCnt + small(i, h - 1, num); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | // 查询排名第x的key是什么 |
| 208 | public static int index(int x) { |