目 录
1 课题描述...................................................................................................................................................1
2 系统设计...................................................................................................................................................1
2.1 功能模块设计................................................................................................................................1
2.1.1 基于单链表设计.................................................................................................................1
(1)节点结构单元模块——定义有序表的节点结构;...............................................................1
typedef struct LNode//定义结构体类型指针.....................................................................................1
{ char data;............................................................................................................................................1
struct LNode*next;...............................................................................................................................1
}*pointer;..............................................................................................................................................1
(2)有序表单元模块——实现有序表的抽象数据类型;...........................................................1
(3)集合单元模块——实现集合获得抽象数据类型;...............................................................1
(4)主程序模块................................................................................................................................1
2.1.2 基于顺序表设计.................................................................................................................2
(1)顺序表结构单元模块——定义顺序表的结构体;...............................................................2
typedef struct //定义 SeqList 的结构体{.....................................................................................2
DataType list[MaxSize];...............................................................................................................2
int size ;.........................................................................................................................................2
} SeqList;......................................................................................................................................2
(2)函数单元模块——定义各种所需函数;................................................................................2
int ListDel( SeqList *L , int i , DataType *x)//顺序表的删除函数............................................2
int ListGet(SeqList L , int i , DataType *x)//获取顺序表的元素函数.......................................2
void ListFind(SeqList L , DataType x)//顺序表查找元素函数..................................................2
void SelcetSort(SeqList *L )//顺序表选择排序函数..................................................................2
void UnionSet(SeqList mylist1 , SeqList mylist2)//求并集函数................................................2
void MixedSet(SeqList mylist1 , SeqList mylist2)//求交集元素函数.......................................2
void DiffentSet(SeqList mylist1 , SeqList mylist2) //求差集元素函数.....................................2
(3)主函数单元模块——定义主函数;................................................................................2
void main()...................................................................................................................................2
{ SeqList mylist1 , mylist2;//定义顺序表 mylist........................................................................2
int i;...............................................................................................................................................2
DataType temp;............................................................................................................................2
ListInitiate( &mylist1);.................................................................................................................2
ListInitiate( &mylist2);}//初始化两个顺序表............................................................................2
2.2 数据结构设计................................................................................................................................2
2.2.1 基于单链表设计.................................................................................................................2
typedef struct LNode//定义结构体类型指针.....................................................................................2
2.1.2 基于顺序表设计.................................................................................................................3
typedef struct //定义 SeqList 的结构体.......................................................................................3
{ DataType list[MaxSize];............................................................................................................3
int size ;.........................................................................................................................................3
void UnionSet(SeqList mylist1 , SeqList mylist2) //求并集.......................................................3
{....................................................................................................................................................3
int m, i,j ;......................................................................................................................................3
DataType x;...................................................................................................................................3
SeqList Test ;................................................................................................................................3
ListInitiate( &Test); //定义并初始化..........................................................................................3
2.3 算法设计........................................................................................................................................3
2.3.1 基于单链表,顺序表设计.................................................................................................3
3.1 菜单设计(基于单链表)............................................................................................................5
2 / 28