/**
* @Params :
* @Author :scy
* @Date :2019/6/20
* description:直接插入排序
*/
public static int[] directInsertSort(int[] array) {
int len = array.length;
int temp;
int j;
for (int i = 1; i < len; i++) {
temp = array[i];//標記當前需要插入的數
for (j = i; j > 0 && temp < array[j - 1]; j--) {//當前數小於前面數
array[j] = array[j - 1];//那麼前面的數就後移
}
array[j] = temp;
}
return array;
}