package sort;
/**
* Created by ozc on 2018/3/26.
*
* @author ozc
* @version 1.0
*/
public class ShellSort {
public static void main(String[] args) {
int[] arrays = {6, 4321, 432, 344, 55 };
shellSort(arrays);
System.out.println("Java3y" + arrays);
}
/**
*
*
* @param arrays
*/
public static void shellSort(int[] arrays) {
///2
for (int step = arrays.length / 2; step > 0; step /= 2) {
//
for (int i = step; i < arrays.length; i++) {
int j = i;
int temp = arrays[j];
// j - step
while (j - step >= 0 && arrays[j - step] > temp) {
arrays[j] = arrays[j - step];
j = j - step;
}
arrays[j] = temp;
}
}
}
}