/*************************************************************
顺序表的合并 实现文件
更新于2020年4月13日
**************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "Seqlist.h"
void SL_Initiate(SqList &L)
// 顺序表的初始化,即构造一个空的顺序表
{
L.elem = (ElemType*)malloc(sizeof(ElemType)*MAXSIZE);
L.length=0;
}
void SL_Free(SqList &L)
// 释放顺序表
{
free(L.elem);
}
bool SL_IsEmpty(SqList L)
// 判断顺序表是否空
{
return L.length==0;
}
bool SL_IsFull(SqList L)
// 判断顺序表是否满
{
return L.length==MAXSIZE;
}
void SL_Create(SqList &L,int n)
// 输入n个数据元素,创建一个顺序表L
{
int i;
L.length=n;
for(i=0; i<n; i++)
scanf("%d", &L.elem[i]);
}
void SL_Print(SqList L)
// 输出整个顺序表
{
if (L.length==0)
{
printf("The slist is empty.\n");
return;
}
for (int i=0; i<L.length; i++)
printf("%d ", L.elem[i]);
printf("\n&
10-03
778
