- 1
- 0
- 约2.15千字
- 约 3页
- 2018-02-09 发布于河南
- 举报
数据结构结合求并
数据结构结合求并
说明:分别用两个线性表对集合进行表示,将其中一个集合并到另一个集合。
程序如下(C++/VC环境)
#define INITSIZE 10
#define INCREASEMENT 2
#define OVERFLOW -1
#define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0
#include iostream.h
#includestdio.h
#includestdlib.h
#includemalloc.h
typedef int Status;
typedef char ElemType;
typedef struct{
ElemType *elem;
int length;
int listsize;
}SqList;
Status InitList(SqList L){
L.elem=(ElemType *)malloc(INITSIZE*sizeof(ElemType));
if(!L.elem) exit(OVERFLOW);
L.length=0;
L.listsize=INITSIZE;
return OK;
}//InitList
Status ListInsert(SqList L,int i,ElemType e){
if(L.length=L.l
原创力文档

文档评论(0)