
数据结构c++实现
一些常见数据结构的c++实现。
光羽隹
继续学习。
展开
-
数据结构c++实现——图
各种模板类的数据抽象: 步骤示意: 递归过程: 要创建的图以及对应的邻接表: 代码实现: //graph.h #ifndef GRAPH_H #define GRAPH_H #include <string> template<typename T> class VertexNode; template<typename T>...原创 2019-04-18 22:34:00 · 2736 阅读 · 0 评论 -
数据结构c++实现——二叉树
binar_tree.h #ifndef BINAR_TREE_H #define BINAR_TREE_H #include <string> template<typename T> class BinarTree; template<typename T> class TreeNode { friend class BinarTree&...原创 2019-04-13 20:15:42 · 236 阅读 · 0 评论 -
数据结构c++实现——串的KMP算法
#include <iostream> #include <string> #include <vector> using namespace std; void get_next1(string T, int *next){ int i, j; i = 1; j = 0; //next下标从1开始计数 next[1...原创 2019-04-12 17:06:23 · 387 阅读 · 0 评论 -
数据结构c++实现——栈与队列
stack.h #ifndef STACK_H #define STACK_H #include <string> const int MAXSIZE = 200; template<typename T> class Stack { public: Stack():top(-1) {} //是否为空 bool empty(); ...原创 2019-04-10 20:17:15 · 302 阅读 · 0 评论 -
数据结构c++实现——线性表的链式结构
1.全部基于c++模板实现。 2.实现了 单向链表(link_list.h) 循环链表(c_link_list.h) 双向链表(d_link_list.h) link_list.h #ifndef LINK_LIST_H #define LINK_LIST_H #include <string> template<typename T> class ...原创 2019-04-07 23:23:02 · 565 阅读 · 1 评论 -
数据结构c++实现——线性表的顺序结构
#include <iostream> using namespace std; const int max_size = 200; template<typename T> class Linear_table { public: Linear_table(){length = 0;} Linear_table(T a[], size_t n); ...原创 2019-04-03 17:30:27 · 203 阅读 · 0 评论