#include
using namespace std;
// 折半插入排序
void BinSort(int *a,int n){
for(int i=1;i<n;i++){
int low = 0,high = i-1,mid;
while(high>=low){
mid = (high+low)/2;
if(a[i]<=a[mid]) high = mid-1;
else low = mid+1;
}
int temp = a[i];
for(int j=i-1;j>low-1;j–){
a[j+1] = a[j];
}
a[low]=temp;
}
}
int main(){
int a[10] = {1,3,5,3,78,26,86,9,7,41};
BinSort(a,10);
for(int i=0;i<(sizeof(a)/sizeof(int));i++){
cout<<a[i]<<" ";
}
}