下面函数的功能是:在一个递增有序的顺序表 L 中插入元素 x 后仍有序。将算法补充完整。 说明:顺序表的类型定义如下: #define MAXSIZE 100 // 最大长度 typedef struct { ElemType elem[MAXSIZE]; // 存放元素 int length; // 线性表的当前长度 }SqList ; /****************************************/ void Insert(SqList *L, ElemType x) { int i,j; if(L->length==MAXSIZE) // 判表满 { printf("full\n");return; } for(i=0; i
length; i++) // 从顺序表 L 的第 1 个元素开始依次与 x 比较 if( __ _ 1 __ __ )break; for(j=L->length-1; __ _ 2 __ __; j--) L->elem[j+1]=L->elem[j]; // 元素后移 L->elem[i]=x; // 插入 x L->length++; }