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

Method pre

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

Source from the content-addressed store, hash-verified

155 }
156
157 public static int pre(int num) {
158 int i = head, last = head;
159 int ans = Integer.MIN_VALUE;
160 while (i != 0) {
161 last = i;
162 if (key[i] >= num) {
163 i = left[i];
164 } else {
165 ans = Math.max(ans, key[i]);
166 i = right[i];
167 }
168 }
169 splay(last, 0);
170 return ans;
171 }
172
173 public static int post(int num) {
174 int i = head, last = head;

Callers 1

mainMethod · 0.95

Calls 2

splayMethod · 0.95
maxMethod · 0.45

Tested by

no test coverage detected