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

Method main

src/class148/Code01_AVL1.java:249–278  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

247 }
248
249 public static void main(String[] args) throws IOException {
250 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
251 StreamTokenizer in = new StreamTokenizer(br);
252 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
253 in.nextToken();
254 int n = (int) in.nval;
255 for (int i = 1, op, x; i <= n; i++) {
256 in.nextToken();
257 op = (int) in.nval;
258 in.nextToken();
259 x = (int) in.nval;
260 if (op == 1) {
261 add(x);
262 } else if (op == 2) {
263 remove(x);
264 } else if (op == 3) {
265 out.println(rank(x));
266 } else if (op == 4) {
267 out.println(index(x));
268 } else if (op == 5) {
269 out.println(pre(x));
270 } else {
271 out.println(post(x));
272 }
273 }
274 clear();
275 out.flush();
276 out.close();
277 br.close();
278 }
279
280}

Callers

nothing calls this directly

Calls 10

addMethod · 0.95
removeMethod · 0.95
rankMethod · 0.95
indexMethod · 0.95
preMethod · 0.95
postMethod · 0.95
clearMethod · 0.95
printlnMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected