⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edge.h

📁 一个效率还可以的配对堆 Fibonacci Heap太难写了 配对堆可以有效替代Fibonacci Heap 附带了用它实现的Dijkstra 复杂度O(nlogn+e)
💻 H
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -