随笔分类 -  [c++数据结构]

摘要:// crikal.cpp : 定义控制台应用程序的入口点。 // #include "iostream" #include "vector" #include "stack" #include using namespace std; #define MaxNumVertex 20 //最大顶点数 #define MaxNumEdge 40 //最大边数 #define i... 阅读全文
posted @ 2017-04-11 11:28 指间ゝ繁华初逝的格调 阅读(193) 评论(0) 推荐(0)
摘要:1 #include "iostream" 2 #include "vector" 3 using namespace std; 4 5 const int maxlen = 100; 6 #define infinity 65535 7 8 struct bnode 9 {... 阅读全文
posted @ 2015-12-09 18:02 指间ゝ繁华初逝的格调 阅读(276) 评论(0) 推荐(0)
摘要:1 #include "iostream" 2 using namespace std; 3 4 typedef char type; 5 struct bnode{ 6 type data; 7 type parent; 8 bnode *lchild,... 阅读全文
posted @ 2015-12-08 19:16 指间ゝ繁华初逝的格调 阅读(511) 评论(0) 推荐(0)
摘要:1 #include "iostream" 2 #include "stdlib.h" 3 using namespace std; 4 5 typedef char type; 6 struct bnode{ 7 type data; 8 bnode *lchi... 阅读全文
posted @ 2015-12-08 16:10 指间ゝ繁华初逝的格调 阅读(204) 评论(0) 推荐(0)
摘要:1 #include "iostream" 2 using namespace std; 3 4 typedef char type; 5 struct bnode{ 6 type data; 7 bnode *lchild,*rchild; 8 }; 9 10 class tr... 阅读全文
posted @ 2015-12-07 17:02 指间ゝ繁华初逝的格调 阅读(196) 评论(0) 推荐(0)
摘要:顺序表: 1 #include 2 using namespace std; 3 4 enum error{rangeerror,underflow,overflow,success}; 5 const int maxlen=1000; 6 7 class list{ 8 pub... 阅读全文
posted @ 2015-12-05 18:47 指间ゝ繁华初逝的格调 阅读(203) 评论(0) 推荐(0)
摘要:链栈: 1 #include 2 using namespace std; 3 struct node{ 4 int data; 5 node *next; 6 }; 7 enum error{underflow,overflow,success,fail}; 8 class sta... 阅读全文
posted @ 2015-12-05 18:26 指间ゝ繁华初逝的格调 阅读(249) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 using namespace std; 4 5 enum error{overflow,underflow,success}; 6 const int maxlen=100; 7 8 class queue{ 9 public:10 q... 阅读全文
posted @ 2015-12-05 17:25 指间ゝ繁华初逝的格调 阅读(210) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 using namespace std; 4 5 enum error{overflow,underflow,success}; 6 const int maxlen=100; 7 8 class stack 9 { 10 p... 阅读全文
posted @ 2015-12-05 17:07 指间ゝ繁华初逝的格调 阅读(164) 评论(0) 推荐(0)
摘要:1 #include "iostream" 2 #include "iomanip" 3 #include "time.h" 4 using namespace std; 5 6 #define num 13 7 8 struct Bnode{ 9 int data;10 Bn... 阅读全文
posted @ 2015-12-04 21:49 指间ゝ繁华初逝的格调 阅读(249) 评论(0) 推荐(0)
摘要:简单顺序查找,有序表的二分查找,索引顺序表的查找 1 #include "iostream" 2 #include "iomanip" 3 #include "time.h" 4 #include "stdlib.h" 5 using namespace std; 6 7 #defi... 阅读全文
posted @ 2015-12-04 17:50 指间ゝ繁华初逝的格调 阅读(207) 评论(0) 推荐(0)
摘要:1 #include "iostream" 2 #include "iomanip" 3 #include "time.h" 4 using namespace std; 5 6 #define num 28 7 typedef int type;//type类型为int 8 9 /*10 *... 阅读全文
posted @ 2015-12-04 12:04 指间ゝ繁华初逝的格调 阅读(224) 评论(0) 推荐(0)
摘要:1 #include "iostream" 2 #include "vector" 3 #include "time.h" 4 #include "iomanip" 5 using namespace std; 6 7 #define num 25 8 typedef int t... 阅读全文
posted @ 2015-12-04 10:32 指间ゝ繁华初逝的格调 阅读(177) 评论(0) 推荐(0)
摘要:有向图图中任何两个可到达的顶点之间最短路径以及相应的长度Dijkstra算法 和Floyd算法 1 #include "iostream" 2 #include "vector" 3 #include "stdlib.h" 4 using namespace std; 5 6 cons... 阅读全文
posted @ 2015-12-03 16:16 指间ゝ繁华初逝的格调 阅读(376) 评论(0) 推荐(0)
摘要:从单个顶点到其余各顶点之间的最短路径: 1 #include "iostream" 2 #include "vector" 3 #include "stack" 4 using namespace std; 5 6 const int MaxNumVertex = 20; //最大顶... 阅读全文
posted @ 2015-12-02 17:35 指间ゝ繁华初逝的格调 阅读(166) 评论(0) 推荐(0)
摘要:关键路径求解 1 #include "iostream" 2 #include "vector" 3 #include "stack" 4 using namespace std; 5 6 const int MaxNumVertex = 20; //最大顶点数 7 const i... 阅读全文
posted @ 2015-12-02 12:07 指间ゝ繁华初逝的格调 阅读(417) 评论(0) 推荐(0)
摘要:拓扑排序方法:①找出一个入度为0的顶点,输出(作为序列的一个元素)②删除顶点v及其牺牲你关掉的弧,(因而后继定点的入度为1,并可能出现新的入度为0的顶点)③重复上述步骤①②,直到找不到入度为0的顶点为止。(拓扑序列不唯一) 1 #include "iostream" 2 #include "st... 阅读全文
posted @ 2015-12-01 17:15 指间ゝ繁华初逝的格调 阅读(194) 评论(0) 推荐(0)
摘要:Prim 算法求解方法:首先将所指定的起点作为已选顶点,然后反复在满足如下条件下的边中选择一条最小边,直到所有顶点已成为已选顶点为止(选择n-1条边)。 1 #include "iostream" 2 using namespace std; 3 4 typedef char Vertex... 阅读全文
posted @ 2015-12-01 14:51 指间ゝ繁华初逝的格调 阅读(250) 评论(0) 推荐(0)
摘要:1 #include "iostream" 2 #include "queue" 3 using namespace std; 4 5 const int MaxNumVertex = 100; //最大顶点数 6 typedef int elementtype; //... 阅读全文
posted @ 2015-11-13 22:05 指间ゝ繁华初逝的格调 阅读(319) 评论(0) 推荐(0)
摘要:1 #include 2 using namespace std; 3 4 int shell_sort(int n,int array[100]){//希尔排序法 5 register int dh,temp,i,j; 6 dh=n/2; 7 while(dh>=1){... 阅读全文
posted @ 2015-11-13 21:33 指间ゝ繁华初逝的格调 阅读(176) 评论(0) 推荐(0)