2024年8月9日

stm32标准库点灯

摘要: 使用标准库3.5.0版本进行点灯操作 LED原理图: 根据原理图我们得知,LED连接在PC13口,且低电平输出(0是亮,1是灭); GPIO的八种工作模式(来源于江科大ppt) IO口采用推挽输出。 要使用芯片输出高低电平,需要一个时钟产生脉冲,则根据芯片参考手册设置控制IO口的时钟寄存器RCC_A 阅读全文

posted @ 2024-08-09 16:55 四马路弗洛伊德 阅读(122) 评论(0) 推荐(0)

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)

2023年11月27日

DFS算法的非递归遍历分析

摘要: 两种写法,一个是边表顶点号全部压栈,一个是类似后序非递归遍历 1、 void DFS(Graph G,int i) { int p,w; Stack S; InitStack(S); Push(S,i); visited[i]=true; while(!isEmpty(S)) { Pop(S,p); 阅读全文

posted @ 2023-11-27 22:27 四马路弗洛伊德 阅读(269) 评论(0) 推荐(0)

2023年11月26日

邻接矩阵

摘要: #include <stdio.h> #include <stdlib.h> #define MaxSize 20 typedef int VertexType; typedef int EdgeType; typedef int Elem ; typedef struct{ //邻接矩阵 Vert 阅读全文

posted @ 2023-11-26 22:17 四马路弗洛伊德 阅读(34) 评论(0) 推荐(0)

导航