摘要: 循环链表,顺便也附上链表的迭代器 1 #include <iostream> 2 3 using namespace std; 4 5 template<class T> class List; 6 template<class T> class ListIterator; 7 8 template 阅读全文
posted @ 2020-03-14 19:50 yg_staring 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 通过数组建立队列 1 #include <iostream> 2 3 using namespace std; 4 5 template<class T> 6 class MyQueue 7 { 8 public: 9 MyQueue(int queuecapacity=10); 10 ~MyQue 阅读全文
posted @ 2020-03-14 19:46 yg_staring 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 通过数组建立栈 1 #include <iostream> 2 3 using namespace std; 4 5 template<class T> 6 int ChangeSize1D(T *a, const int oldSize, const int newSize ) 7 { 8 if( 阅读全文
posted @ 2020-03-14 19:44 yg_staring 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 不使用循环,采用头尾指针,不带有头结点,我这里只是简易的输出,并没有写专用的迭代器。 1 #include <iostream> 2 3 using namespace std; 4 5 template<class T> class MyList; 6 7 template<class T> 8 阅读全文
posted @ 2020-03-14 19:39 yg_staring 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 使用邻接表建立图,直接使用了c++已经写好的list 1 #include <iostream> 2 #include <list> 3 4 using namespace std; 5 6 class Vertex 7 { 8 public: 9 char Label; 10 Vertex(cha 阅读全文
posted @ 2020-03-14 19:36 yg_staring 阅读(185) 评论(0) 推荐(0) 编辑
摘要: DFS使用c++中的stack,BFS使用c++中的queue 1 #include <iostream> 2 #define MAX_VERTS 20 3 #include <stack> 4 #include <queue> 5 6 using namespace std; 7 8 class 阅读全文
posted @ 2020-03-14 19:33 yg_staring 阅读(587) 评论(0) 推荐(0) 编辑