设顺序表的存储类型定义如下:#define ListSize 100typedef int KeyType;typedef st

设顺序表的存储类型定义如下:
#define ListSize 100
typedef int KeyType;
typedef struct{
KeyType key;
}NodeType;
typedef NodeType SeqList[ListSize];
函数f32()的功能是,基于二分查找在长度为n的有序表R中插入一个关键字x,并保持R的有序性。请在空白处填上适当语句使算法正确。
void f32(SeqList R,KeyType x,int n)
{
int low=0,high=n-1,mid,inspace,i,find=0;
while(low<=high&&!find){
mid=(low+high)/2;
if(x<R[mid].key)___(1)___;
else if(x> R[mid].key)low=mid+1;
else find=l;
}
if(find)
inspace=___(2)___;
else
inspace=low;
for(i=n;___(3)___;i--)
R[i+1]=R[i];
R[inspace].key=x;
}
【正确答案】:(1)high=mid-1
(2)mid
(3)i> =inspace