注意:此页面搜索的是所有试题
下面程序实现插入排序算法。

typedef struct{

int key;

Info otherinfo;

}SeqList;

void InsertSort(SeqList R[],int n)

{/* 待排序列保存在R[1..n]中*/

SeqList x;

int i,j,k,lo,hi,mi;

for (i=2;i<=n;i++)

{

(1) ;

lo=1;

hi=i-l;

while (lo<=hi)

{

mi=(lo+hi)/2;

if ( (2) ) break;

if (R[mi].key>x.key) hi=mi-l;

else lo=mi+l;

}

if (mi=lo) k=i - mi;

else k=i - mi-1;

for (j=0;j<k;j++)

(3) ;

R[i-j]=x;

}

}

在空白处填写适当的内容,使该程序功能完整。

参考答案