本题要求实现一个函数,要求将指定元素插入到有序表的合适位置,使得插入后仍然保持有序,若插入失败返回0;插入成功则返回1,并且顺序表的长度加1.
函数接口定义:
int SqInsert(SqList &L,ElemType e);
其中SqList结构定义如下:
typedef struct{
ElemType *elem;
int length;
}SqList;
裁判测试程序样例:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 5
typedef int ElemType;
typedef struct{
ElemType