edge.h
来自「一个效率还可以的配对堆 Fibonacci Heap太难写了 配对堆可以有效」· C头文件 代码 · 共 49 行
H
49 行
#ifndef LINK
#define LINK
#include<cstdio>
class edgenode
{
public:
int to,w;
edgenode *next;
edgenode(int t=0,int w1=0):to(t),w(w1),next(NULL){};
edgenode(const edgenode &s):to(s.to),w(s.w),next(NULL){};
operator int ()
{
return w;
}
~edgenode(){if(next!=NULL)delete next;}
};
class edge
{
private:
edgenode *head,*current;
public:
edge():head(NULL),current(NULL){}
void seekend(void){if(head==NULL)return;current=head;while(current->next!=NULL)current=current->next;}
void repos(void){current=head;}
void insert(int to,int w)
{
if(head==NULL)
{
head=new edgenode(to,w);
current=head;
}
else
{
current->next=new edgenode(to,w);
current=current->next;
}
}
bool operator ++ (int){if(current==NULL)return false;current=current->next;return true;}
edgenode * operator -> () {return current;}
bool isrear(void){return current==NULL?true:false;}
~edge(){delete head;delete current;}
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?