static void HalfSort(int[] array)
{
for (int i = 1; i < array.Length; i++)
{
int temp = array[i];//temp为插入的值
int l = 0;
int r = i - 1;
int m = i;
while (l <= r)
{
m = l + (r - l) / 2;
if (array[m] < temp)
{
l = m + 1;
}
else
{
r = m - 1;
}
}
for (int j = i - 1; j > r; j--) //将(r+1)~i的所有元素后移一位
{
array[j + 1] = array[j];
}
array[r + 1] = temp; //插入元素
PrintArray(array);
}
}