2023年12月2日

求最短路径迪杰斯特拉算法

摘要: 代码运行截图: 完整代码: #include <stdio.h> #include <stdlib.h> #define MaxSize 20 #define MAX 999 typedef struct ArcNode{ //边表 int adjvex; //边表中是顶点号!! struct Ar 阅读全文

posted @ 2023-12-02 21:02 四马路弗洛伊德 阅读(30) 评论(0) 推荐(0)

希尔排序

摘要: #include <stdio.h> #include <stdlib.h> void shellSort(int arr[],int n) { int dk,i,j,p; for(dk=n/2;dk>=1;dk=dk/2) { for(i=dk+1;i<n;i++) { if(arr[i]<arr 阅读全文

posted @ 2023-12-02 15:28 四马路弗洛伊德 阅读(9) 评论(0) 推荐(0)

选择排序

摘要: #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct{ int NO; int Age; char Name[50]; }Student; typedef struct{ int StudentCount; 阅读全文

posted @ 2023-12-02 15:28 四马路弗洛伊德 阅读(28) 评论(0) 推荐(0)

冒泡排序

摘要: #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct{ int NO; int Age; char Name[50]; }Student; typedef struct{ int StudentCount; 阅读全文

posted @ 2023-12-02 15:27 四马路弗洛伊德 阅读(13) 评论(0) 推荐(0)

快速排序

摘要: #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct{ int NO; int Age; char Name[50]; }Student; typedef struct{ int StudentCount; 阅读全文

posted @ 2023-12-02 15:27 四马路弗洛伊德 阅读(8) 评论(0) 推荐(0)

折半插入排序

摘要: 折半是查找函数,是在已排序序列中找到合适的位置让元素插入 首先明确,插入排序算法,是将未排序元素插入到已排序序列中去,重要的始终是已排序序列。 折半查找,就是为了提高在已排序序列中查找最终位置的效率 ACC==1升序,ACC 1降序 #include <stdio.h> #include <stdl 阅读全文

posted @ 2023-12-02 14:25 四马路弗洛伊德 阅读(31) 评论(0) 推荐(0)

直接插入排序

摘要: 0 1 2 3 4 5 2 8 12 3 从下标1开始遍历,默认第一个元素是已排序序列。 例如对元素3进行插入排序: 下标0-3分别是2-5-8-12; 此时k=arr[4]=3; j=i-1=3; 从后往前遍历找到k应该插入的位置 当while循环条件 j>=0&&arr[j]>k 一直成立时,a 阅读全文

posted @ 2023-12-02 13:54 四马路弗洛伊德 阅读(12) 评论(0) 推荐(0)

导航