Loading

摘要: 文章目录 二叉搜索树定义优点 代码实现 二叉搜索树 定义 优点 代码实现 #include<iostream> using namespace std; typedef int Elemtype; typedef struct node { Elemtype data; struct node* l 阅读全文
posted @ 2022-06-23 08:36 墨鱼yyyl 阅读(15) 评论(0) 推荐(0)
摘要: 文章目录 代码实现 代码实现 #include<iostream> using namespace std; typedef int elemtype; //堆排序 void HeapSort(int arr[], int n); void heapInsert(int arr[], int n); 阅读全文
posted @ 2022-06-23 08:34 墨鱼yyyl 阅读(9) 评论(0) 推荐(0)
摘要: 文章目录 代码实现 代码实现 #include<iostream> using namespace std; typedef int elemtype; //归并排序 void MergeSort(elemtype arr[], int n); void Msort(elemtype arr[], 阅读全文
posted @ 2022-06-23 08:33 墨鱼yyyl 阅读(8) 评论(0) 推荐(0)
摘要: 文章目录 代码实现 代码实现 #include<iostream> using namespace std; typedef int elemtype; //快速排序 void QuickSort(elemtype arr[], int n); void Quick(elemtype arr[], 阅读全文
posted @ 2022-06-23 08:31 墨鱼yyyl 阅读(5) 评论(0) 推荐(0)
摘要: 文章目录 选择排序插入排序冒泡排序希尔排序 选择排序 #include<iostream> using namespace std; typedef int elemtype; //选择排序 void SelectSort(elemtype arr[], int n); //int main() / 阅读全文
posted @ 2022-06-23 08:28 墨鱼yyyl 阅读(8) 评论(0) 推荐(0)
摘要: 文章目录 算法实现并查集 算法实现 使用并查集进行实现 并查集 。。。。。(后面会再补充解释) #include<iostream> using namespace std; /*边定义*/ typedef struct { int v1, v2; //边顶点v1 v2 int weight; // 阅读全文
posted @ 2022-06-22 21:04 墨鱼yyyl 阅读(8) 评论(0) 推荐(0)
摘要: 文章目录 算法实现 算法实现 #include<iostream> #include<stack> using namespace std; typedef int Vertextype; typedef struct ArcNode { int index; int weight; struct 阅读全文
posted @ 2022-06-22 21:01 墨鱼yyyl 阅读(12) 评论(0) 推荐(0)
摘要: 文章目录 弗洛伊德算法算法实现 弗洛伊德算法 用于求取连通图中任意点到其他点的最短路径的算法,相比于迪杰斯特拉算法,在代码实现上更加简洁,复杂度系数也要小一些。 算法实现 #include<iostream> using namespace std; #define MAX 10000000 //打 阅读全文
posted @ 2022-06-22 20:58 墨鱼yyyl 阅读(18) 评论(0) 推荐(0)
摘要: 文章目录 迪杰斯特拉算法算法实现 迪杰斯特拉算法 迪杰斯特拉算法 用于求取单个点到其他点的最短路径算法 我的理解是:在选取v作为初始顶点后进行计算,对其余顶点都进行一次判断,如果v到其他顶点有路径则在这些路径中选取权值最小的一条作为第二次初始顶点开始进行计算。这样一层一层往外面扩张。 算法实现 #i 阅读全文
posted @ 2022-06-22 20:54 墨鱼yyyl 阅读(18) 评论(0) 推荐(0)
摘要: 文章目录 图逻辑结构与内存结构结构实现方法重要算法最小生成树算法拓扑排序最短路径算法 基础生成等算法 图 逻辑结构与内存结构 结构实现 邻接矩阵实现邻接表实现 typedef int VertexType; typedef struct ArcNode { /*单链表中结点类型*/ int adjv 阅读全文
posted @ 2022-06-22 19:37 墨鱼yyyl 阅读(12) 评论(0) 推荐(0)