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

📄 lbase.h

📁 一本全面剖析C++数据结构算法的书籍
💻 H
字号:
 // file lbase.h// initial linked base for linked graph representations#ifndef LinkedBase_#define LinkedBase_#include <iostream.h>#include <stdlib.h>#include "fchain.h"#include "xcept.h"template <class T> class LinkedWDigraph;template <class T> class LinkedWGraph;template<class T>class LinkedBase {   friend class LinkedDigraph;   friend class LinkedGraph;   friend LinkedWDigraph<int>;   friend LinkedWGraph<int>;   public:      LinkedBase(int Vertices = 10)         {n = Vertices;          e = 0;          h = new Chain<T> [n+1];}      ~LinkedBase() {delete [] h;}      int Edges() const {return e;}      int Vertices() const {return n;}      int OutDegree(int i) const         {if (i < 1 || i > n) throw OutOfBounds();          return h[i].Length();}      void Output() const;   private:      int n;       // number of vertices      int e;       // number of edges      Chain<T> *h; // adjacency list array};template<class T>void LinkedBase<T>::Output() const{// Output the adjacency lists.   for (int i = 1; i <= n; i++) {      cout << "Vertex " << i << " = ";      h[i].Output(cout);      cout << endl;}}#endif

⌨️ 快捷键说明

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