文章
19
粉丝
0
获赞
4
访问
10.8k
#include<bits/stdc++.h>
using namespace std;
int insert_sort(int arr[], int length) {
int count = 0;
for (int i = 1; i < length; i++) {
int key = arr[i];
int j;
for (j = i - 1; (j >= 0) && (arr[j] > key); j--) {
arr[j + 1] = arr[j];
count++;
}
arr[j + 1] = key;
}
return count;
}
int main() {
int arr[100001];
int n;
cin >> n;
for (int i = 0; i < n; i++) {
scanf_s("%d", &arr[i]);
}
/*int coun...
登录后发布评论
暂无评论,来抢沙发