?? cirlinklist.h
字號:
//單循環(huán)鏈表的類定義cirlinklist.h
#define LEN 20
typedef int ElemType;
//單循環(huán)鏈表中結點的類型
typedef struct Lnode {
ElemType data; //值域
Lnode* next; //指針域
}LNode;
class cirlinklist
{private:
LNode *head;//指向表頭的指針
LNode *curr;//當前結點指針
int count;// 單循環(huán)鏈表的結點個數(shù)
public:
//構造函數(shù)
cirlinklist();
//析構函數(shù)
~cirlinklist(){delete head;}
//創(chuàng)建有序或無序的帶頭結點的單循環(huán)鏈表
LNode *CreateCLinkL(int,int mark=0);
//清空單循環(huán)鏈表
void ClearCList();
//求單循環(huán)鏈表長度
int CListSize();
//檢查單循環(huán)鏈表是否為空
bool CListEmpty();
//返回指向第pos個結點的指針
LNode *Index(int pos);
//返回單循環(huán)鏈表中指定序號的結點值
ElemType GetElem(int pos);
//遍歷單循環(huán)鏈表
LNode *TraverseCList();
//當前指針curr指向pos結點并返回curr
LNode *Reset(int pos=0);
//當前指針curr指向下一結點并返回
LNode *Next();
// 判單循環(huán)鏈表當前指針curr==head 否
bool EndOCList();
//判單循環(huán)鏈表當前指針curr->next是否到達表尾
bool EndCList();
//刪除單循環(huán)鏈表當前指針curr->next所指結點并返回其值
ElemType DeleteNext();
//從單循環(huán)鏈表中查找元素
bool FindCList(ElemType& item);
//更新單循環(huán)鏈表中的給定元素
bool UpdateCList(const ElemType &item,ElemType &e);
//向鏈表中第pos個結點后插入域值為item的新結點
void InsertCList(const ElemType& item,int pos);
//從鏈表中刪除第pos個結點并返回被刪結點的data
ElemType DeleteCList(int pos);
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -