数据结构----线性表操作
1. 有两张 非递增 有序的线性表 A , B ,采用顺序存储结构,两张表合并用 c 表存,要求 C 为 非递减 有序的,然后删除 C 表中值相同的多余元素。 #include<iostream> using namespace std; #define MAXSIZE 100 #define OVERFLOW -1 #define ERROR 0 #define OK 1 typedef int Status; typedef int ElemType; //顺序存储 typedef struct { ElemType *elem; int length; }sqlist; sqlist la,lb,lc; sqlist InitList() { sqlist L; L.elem=new ElemType[MAXSIZE]; if(!L.elem) exit(OVERFLOW); L.length=0; return L; } sqlist ListInsert(sqlist &L,int i,ElemType e) { if(L.length==MAXSIZE) exit(OVERFLOW); L.elem[i]=e; ++L.length; return L; } sqlist Listsort(sqlist &L) { int i,j; for(i=0;i<L.length