折半插入排序
来源:互联网 发布:三维全景图制作软件 编辑:程序博客网 时间:2024/06/16 23:07
void select(int array[],int n)
{
int i,j,key;
int temp1;
int temp;//=array[0];
int low,high,mid;
//temp1=array[0];
for(i=1;i<n;i++)
{
//j=i-1;
temp=array[i];
low=0;
high=i-1 ;
while(low<=high)
{
mid=(low+high)/2;
if(array[mid]>temp)
{
high=mid-1;
//j=high;
}
else
{
low=mid+1;
}
}
for(j=i-1;j>=high+1;j--)
{
array[j+1]=array[j];
}
array[high+1]=temp;
}
}
{
int i,j,key;
int temp1;
int temp;//=array[0];
int low,high,mid;
//temp1=array[0];
for(i=1;i<n;i++)
{
//j=i-1;
temp=array[i];
low=0;
high=i-1 ;
while(low<=high)
{
mid=(low+high)/2;
if(array[mid]>temp)
{
high=mid-1;
//j=high;
}
else
{
low=mid+1;
}
}
for(j=i-1;j>=high+1;j--)
{
array[j+1]=array[j];
}
array[high+1]=temp;
}
}
阅读全文
0 0
- 插入排序--折半插入
- 插入排序--折半插入
- 排序:折半插入排序
- 排序--折半插入排序
- 排序-折半插入排序
- 【插入排序】折半插入排序
- 插入排序--折半插入排序
- 折半插入排序,插入排序
- 折半插入排序
- 折半插入排序
- 折半插入排序算法
- 折半插入排序算法
- 折半插入排序 练习
- 折半插入排序
- 折半插入排序
- 折半插入排序
- 折半插入排序 Java
- 折半插入排序算法
- 在Linux上安装Nginx
- MT 202 General Financial Institution Transfer一般金融机构转账
- Cocos Creator的moveTo函数
- 欧几里德算法&&扩展欧几里德算法 (小推+模板)
- css基础
- 折半插入排序
- tensorflow 自主选择使用的gpu
- 广度优先收索实现迷宫问题
- 阿里云一键部署LNMP环境
- 阿里云windows/Linux 简易建站教程,附WordPress配置方法
- Linux基础——编译运行程序文件
- Spark2.x学习笔记:17、Spark Streaming之HdfsWordCount 学习
- MT 203 Multiple General Financial Institution Transfer多笔一般金融机构转账
- Android学习之WebView基础