1
2
3
4
5
6
7
8
9
10
11
12
13
|
static
void
sellSort(
int
[] array,
int
n) {
int
i, j, gap;
int
temp;
for
(gap = n/
2
; gap>
0
; gap/=
2
) {
for
(i=gap; i<n; i++) {
for
(j = i-gap; j>
0
&& array[j]>array[j+gap]; j-=gap) {
temp = array[j];
array[j] = array[j+gap];
array[j+gap] = temp;
}
}
}
}
|
本文转自yeleven 51CTO博客,原文链接:http://blog.51cto.com/11317783/1977992