MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / small

Method small

src/class149/SkipList1.java:194–205  ·  view source on GitHub ↗
(int i, int h, int num)

Source from the content-addressed store, hash-verified

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) {

Callers 1

rankMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected