public class Sort006 {
public static void shellSort(int [] a){
int gap = a.length/2;
while(gap >0){
for(int i=0;i<a.length;i++){
for(int j=i+gap;j<a.length;j++){
if(a[j]<a[i]){
int temp = a[j];
a[j] = a[i];
a[i] = temp;
}
}
}
gap = gap/2;
}
}
public static void main(String [] args){
int [] a={5,11,9,8,7,6,0,1,3,2};
shellSort(a);
for(int i=0;i<a.length;i++){
System.out.print(a[i]+" ");
}
}
}
public static void shellSort(int [] a){
int gap = a.length/2;
while(gap >0){
for(int i=0;i<a.length;i++){
for(int j=i+gap;j<a.length;j++){
if(a[j]<a[i]){
int temp = a[j];
a[j] = a[i];
a[i] = temp;
}
}
}
gap = gap/2;
}
}
public static void main(String [] args){
int [] a={5,11,9,8,7,6,0,1,3,2};
shellSort(a);
for(int i=0;i<a.length;i++){
System.out.print(a[i]+" ");
}
}
}