intlist.h

来自「矩阵运算的算法 用Type类数组创建矩阵对象 matrix(int ro」· C头文件 代码 · 共 30 行

H
30
字号
#include   "stdafx.h"
#include "Node.h"

class Linklist
{ 
private:
    Node *first,*last,*current,*prior;
public:
	void MakeEmpty();//置空表
	Linklist();
	~Linklist(){MakeEmpty(); delete first;}
	void Initialize(){current = last = first;prior = NULL;}//当表为空表时使指针复位
	
	bool IsEmpty();
	int Getdata();
    int *Get();//返回当前节点的数据域的地址
	bool Put(int &value);//改变当前节点的data,使其为value
	int *GetNext();//返回当前节点的下一个节点的数据域的地址,不改变current
    void Next();//移动current到下一个节点
    void InsertBack(int &value);//在当前节点的后面插入节点,改变current
    void InsertBefore(int &value);//在当前节点的前面插入一节点,不改变current,改变prior
    bool Locate(int i);//移动current到第i个节点
    void First();   //移动current到表头
    void End();//移动current到表尾 
    void Remove();//删除当前节点,current指向下一个节点,如果current在表尾,执行后current = NULL
    void CreatListH(int n=10);  //头插法
    void CreatListR(int n=10);  //尾插法
    void Swaplist();  //倒置链表
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?