//*********************************** //功能:把两个递增的顺序表归并为递减的顺序表,对新表另分配空间 //日期:2017年9月19日 //作者:Ryan2019 //*********************************** #include using namespace std; const int ListlnitSize=0; const int Listlnc=10; typedef int LElemType; struct SList { LElemType *elem; int length,listsize; }; bool Listlnit(SList &L);//顺序表初始化 bool ListCreate(SList &L,int n,LElemType a[]);//创建顺序表 bool Descend(SList &A,SList &B,SList &C);//新表 int main() { const int m=3,n=4; LElemType a[m]={1,3,5}; LElemType b[n]={2,4,6,8}; SList A,B,C; ListCreate(A,m,a); ListCreate(B,n,b); cout<<"线性表A为"<=B.elem[j]) { C.elem[k]=A.elem[i]; k++; i--; } else { C.elem[k]=B.elem[j]; k++; j--; } } C.length=k; return true; }