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

Method main

src/class044/Code02_TrieTree.java:101–126  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

99 public static String[] splits;
100
101 public static void main(String[] args) throws IOException {
102 BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
103 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
104 String line = null;
105 while ((line = in.readLine()) != null) {
106 build();
107 m = Integer.valueOf(line);
108 for (int i = 1; i <= m; i++) {
109 splits = in.readLine().split(" ");
110 op = Integer.valueOf(splits[0]);
111 if (op == 1) {
112 insert(splits[1]);
113 } else if (op == 2) {
114 delete(splits[1]);
115 } else if (op == 3) {
116 out.println(search(splits[1]) > 0 ? "YES" : "NO");
117 } else if (op == 4) {
118 out.println(prefixNumber(splits[1]));
119 }
120 }
121 clear();
122 }
123 out.flush();
124 in.close();
125 out.close();
126 }
127
128}

Callers

nothing calls this directly

Calls 11

buildMethod · 0.95
insertMethod · 0.95
deleteMethod · 0.95
searchMethod · 0.95
prefixNumberMethod · 0.95
clearMethod · 0.95
readLineMethod · 0.80
splitMethod · 0.45
printlnMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected