搜题
问题   更新时间2023/4/3 12:59:00

下面程序实现插入排序算法。

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
(3) ;

R[i-j]=x;

}

}

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

教师释疑: (1)x=R[i](2)R[mi].key=x.key(3)R[i-j]=R[i-j-1]
王老师:19139051760(拨打)