插入排序
插入排序
状态不好,写一点摸了
#include<stdio.h>
void insert_sort(int arr[])
{
for (int i = 1; i < 10; i++)
{
int temp = arr[i];
int j = i - 1;
while (j > -1 && temp < arr[j])
{
arr[j + 1] = arr[j];
j--;
}
arr[j + 1] = temp;
}
}
int main()
{
int arr[10] = { 9,3,5,7,1,2,4,6,8,0 };
insert_sort(&arr);
}