Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbd11ddf

Browse files
committed
KthSort
1 parenta734e68 commitbd11ddf

File tree

3 files changed

+43
-679
lines changed

3 files changed

+43
-679
lines changed

‎KthSort.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
packageAlgorithms;
2+
3+
importjava.util.HashMap;
4+
5+
publicclassKthSort {
6+
publicstaticclassGraph {
7+
Stringname;
8+
HashMap<Graph,Integer>subs;
9+
publicGraph(Stringname) {
10+
this.name =name;
11+
}
12+
}
13+
14+
publicstaticvoidmain(String[]strs) {
15+
// int[] input = new int[]{1,2,4,3,9,11,0};
16+
// sort(input);
17+
// for(int n: input) {
18+
// System.out.print(n + " ");
19+
// }
20+
Graphc1 =newGraph("c1");
21+
22+
//for()
23+
}
24+
25+
publicstaticvoidsort(int[]input) {
26+
if (input ==null) {
27+
return;
28+
}
29+
30+
intlen =input.length;
31+
for (inti =1;i <len;i++) {
32+
intcur =input[i];
33+
intj =i -1;
34+
while (j >=0 &&input[j] >cur) {
35+
input[j +1] =input[j];
36+
j--;
37+
}
38+
39+
input[j +1] =cur;
40+
}
41+
}
42+
43+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp