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

Method post

src/class153/FollowUp1.java:173–187  ·  view source on GitHub ↗
(int num)

Source from the content-addressed store, hash-verified

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

Callers 1

mainMethod · 0.95

Calls 1

splayMethod · 0.95

Tested by

no test coverage detected