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

Method main

src/class028/Code01_RadixSort.java:32–50  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

30 public static int n;
31
32 public static void main(String[] args) throws IOException {
33 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
34 StreamTokenizer in = new StreamTokenizer(br);
35 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
36 in.nextToken();
37 n = (int) in.nval;
38 for (int i = 0; i < n; i++) {
39 in.nextToken();
40 arr[i] = (int) in.nval;
41 }
42 sort();
43 for (int i = 0; i < n - 1; i++) {
44 out.print(arr[i] + " ");
45 }
46 out.println(arr[n - 1]);
47 out.flush();
48 out.close();
49 br.close();
50 }
51
52 public static void sort() {
53 // 如果会溢出,那么要改用long类型数组来排序

Callers

nothing calls this directly

Calls 5

sortMethod · 0.95
printMethod · 0.45
printlnMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected