https://blog.csdn.net/weibo1230123/article/details/81383073
#include<iostream>
#include<time.h>//ctime
using namespace std;
void insert_sort(int a[], int len)
{
for (int i = 1; i < len; i++)
{
int temp = a[i];
int j = i;
while (j > 0 && a[j - 1] > temp)
{
a[j] = a[j - 1];
j--;
}
a[j] = temp;
}
}
int main()
{
int arr[100];
int s;
int startime, endtime;
cin >> s;
for (int i = 0; i < s; i++)
cin >> arr[i];
int n = sizeof(arr) / sizeof(arr[0]);
insert_sort(arr, s);
startime = clock();
for (int i = 0; i < s; i++)
cout<<arr[i]<<" ";
endtime = clock();
cout << "T=" << (double)(endtime-startime) / CLOCKS_PER_SEC;
return 0;
}