all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
public static void shell(int[] a) {
|
||||
int increment = a.length / 2;
|
||||
while (increment > 0) {
|
||||
for (int i = increment; i < a.length; i++) {
|
||||
int j = i;
|
||||
int temp = a[i];
|
||||
while (j >= increment && a[j - increment] > temp) {
|
||||
a[j] = a[j - increment];
|
||||
j = j - increment;
|
||||
}
|
||||
a[j] = temp;
|
||||
}
|
||||
if (increment == 2) {
|
||||
increment = 1;
|
||||
} else {
|
||||
increment *= (5.0 / 11);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue