7️⃣ 插入排序
#include <iostream>
#include <vector>
using namespace std;
void InsertSort(vector<int> &a){
int in, out, temp;
for (out=1; out!=a.size(); out++){
in = out;
temp = a[out];
while(a[in-1]>temp&&in>0){
a[in] = a[in-1];
in--;
}
a[in] = temp;
}
}
int main(){
vector<int> a{3,6,0,7,1,2,9,8,6,4};
InsertSort(a);
for (int i=0; i!=a.size(); i++)
cout << a[i] << " ";
return 0;
}