?? linelist1.h
字號:
//線性表的類定義linelist1.h
#define MaxListSize 20
#define EQUAL 1
typedef struct STU{
char name[10];
char stuno[10];
int age;
int score;
}ElemType;
class List
{private:
//線性表的數組表示
ElemType elem[MaxListSize];
int length;
int MaxSize;
public:
//初始化順序表
void init(List **L,int ms);
//刪除順序表
void DestroyList(List &L){free(&L);}
//將順序表置為空表
void ClearList(){length=0;}
//判斷順序表是否為空表
bool ListEmpty()
{return length==0;}
//判斷順序表是否為滿
bool ListFull()
{return length==MaxSize;}
//決定返回表中元素pre_e的前驅
ElemType PriorElem(ElemType cur_e,ElemType &pre_e);
// 決定返回表中元素next_e的后繼
ElemType NextElem(ElemType cur_e,ElemType &next_e);
//從線性表中刪除表頭、表尾或等于給定值的元素
bool ListDelete(int,ElemType &e);
//遍歷順序表
void ListTraverse();
//返回順序表的長度
int ListLength();
// 獲取順序表中第i 個元素
void GetElem(int,ElemType *);
// 判斷順序表兩元素是否相等
bool EqualList(ElemType *,ElemType *);
// 判斷順序表兩元素是否不等
bool Less_EqualList(ElemType *,ElemType *);
//順序表的查找算法
bool LocateElem(ElemType,int);
//更新線性表中的給定元素
bool UpdateList(ElemType& e,ElemType);
//順序表的合并算法
void MergeList(List *,List *);
//順序表的插入算法
bool ListInsert(int,ElemType &);
//順序表的聯合算法
void UnionList(List *,List *);
//對線性表按升序或降序輸出
void printlist(int);
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -