折半查找
/** * 折半查找 * 折半查找之后把数据插入 * @param numbers */ static void halfSort(int[] numbers,int n){ for (int i = 0; i < numbers.length; i++) { int low =0; int high = i-1; while (low <= high) { int mid = (high + low)/2; if (n < numbers[mid]) { high = mid -1; }else { low = mid +1; } } for (int j = i; j >low +1; j--) { numbers[j] = numbers[j-1]; } numbers[low] = n; } }