keychain.h

来自「数据结构c++语言描述 Borland C++实现」· C头文件 代码 · 共 29 行

H
29
字号

#ifndef KeyedChain_
#define KeyedChain_
// file keychain.h

#include "echain.h"

template<class type>
class KeyedChain : public Chain<type>
{
public:
   int Delete(type& x); // delete x
   ChainNode<type> * First() {return first;}
};

template<class type>
int KeyedChain<type>::Delete(type& x)
{
ChainNode<type> *i = first, *p = 0;
for (; i && i->data != x; p = i, i = i->link);
if (i) {
        if (p) p->link = i->link;
        else first = i->link;
        delete i;
        return 1;}
return 0;
}
#endif

⌨️ 快捷键说明

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