随笔分类 - [c++数据结构]
摘要:// crikal.cpp : 定义控制台应用程序的入口点。 // #include "iostream" #include "vector" #include "stack" #include using namespace std; #define MaxNumVertex 20 //最大顶点数 #define MaxNumEdge 40 //最大边数 #define i...
阅读全文
摘要: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 {...
阅读全文
摘要:1 #include "iostream" 2 using namespace std; 3 4 typedef char type; 5 struct bnode{ 6 type data; 7 type parent; 8 bnode *lchild,...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:顺序表: 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...
阅读全文
摘要:链栈: 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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:简单顺序查找,有序表的二分查找,索引顺序表的查找 1 #include "iostream" 2 #include "iomanip" 3 #include "time.h" 4 #include "stdlib.h" 5 using namespace std; 6 7 #defi...
阅读全文
摘要: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 *...
阅读全文
摘要: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...
阅读全文
摘要:有向图图中任何两个可到达的顶点之间最短路径以及相应的长度Dijkstra算法 和Floyd算法 1 #include "iostream" 2 #include "vector" 3 #include "stdlib.h" 4 using namespace std; 5 6 cons...
阅读全文
摘要:从单个顶点到其余各顶点之间的最短路径: 1 #include "iostream" 2 #include "vector" 3 #include "stack" 4 using namespace std; 5 6 const int MaxNumVertex = 20; //最大顶...
阅读全文
摘要:关键路径求解 1 #include "iostream" 2 #include "vector" 3 #include "stack" 4 using namespace std; 5 6 const int MaxNumVertex = 20; //最大顶点数 7 const i...
阅读全文
摘要:拓扑排序方法:①找出一个入度为0的顶点,输出(作为序列的一个元素)②删除顶点v及其牺牲你关掉的弧,(因而后继定点的入度为1,并可能出现新的入度为0的顶点)③重复上述步骤①②,直到找不到入度为0的顶点为止。(拓扑序列不唯一) 1 #include "iostream" 2 #include "st...
阅读全文
摘要:Prim 算法求解方法:首先将所指定的起点作为已选顶点,然后反复在满足如下条件下的边中选择一条最小边,直到所有顶点已成为已选顶点为止(选择n-1条边)。 1 #include "iostream" 2 using namespace std; 3 4 typedef char Vertex...
阅读全文
摘要:1 #include "iostream" 2 #include "queue" 3 using namespace std; 4 5 const int MaxNumVertex = 100; //最大顶点数 6 typedef int elementtype; //...
阅读全文
摘要: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){...
阅读全文

浙公网安备 33010602011771号