
数据结构
天空飘来五行码
System.out.println("hello,world");
展开
-
(转)字符串匹配的KMP算法
这个是我觉得比较好理解的文章 点这里 可惜没有KMP的代码转载 2021-09-25 09:05:36 · 99 阅读 · 0 评论 -
数据结构C++,线性表的头插法、尾插法建立链表
#include <stdio.h> #include <stdlib.h> #include <time.h> #define N 5 struct LNode{ int data; struct LNode *next; }; //创建随机数组 void createArr(int a[]){ srand(1); for(int i=0;i&l...原创 2019-09-22 18:29:59 · 929 阅读 · 0 评论 -
数据结构C,三元组的建立与打印
#include <stdio.h> #define MaxSize 4 //定义三元组结构,val代表值,i代表行,j代表列 typedef struct Trimat { int val; int i,j; }Trimat; //建立三元组 //a代表二维数组,m代表行数,n代表列数,trimat代表三元组 void createTrimat(int a[][MaxSize...原创 2019-09-28 18:18:35 · 776 阅读 · 0 评论 -
C语言--生成单链表并归并
在天勤数据结构中的归并单链表中,merge中的参数列表使用了&,而&只能在C++中使用。 C中使用会报错[Error] expected ‘;’, ‘,’ or ‘)’ before ‘&’ token 代码: #include "stdio.h" #include <stdlib.h> #define N 5 //建立结构体 typedef struct LNode { int data; struct LNode *next; } LNode; //归并原创 2021-03-03 19:58:39 · 346 阅读 · 1 评论 -
数据结构C:二叉树遍历方法
随机生成二叉树是我自己写的,随机性不是很大,应该也有漏洞,看着办吧。 #include <stdio.h> #include <time.h> #include <stdlib.h> #define maxSize 5 //二叉树的四种遍历方法 //结构体构造 typedef struct BTNode{ int val; struct BTNode*...原创 2019-09-29 18:13:45 · 165 阅读 · 0 评论 -
数据结构C:邻接矩阵的创建与普里姆算法(Prim)
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <limits.h> #define maxSize 5 /* run this program using the console pauser or add your own getch, system("pa...原创 2019-10-11 20:26:36 · 406 阅读 · 0 评论 -
数据结构C:邻接表的创建与DFS
#include <iostream> #include <stdio.h> #include <stdlib.h> #define maxSize 5 //邻接表结构 //边的结构 struct ArcNode{ //该顶点的下一条边 struct ArcNode *nextArc; //这条边所指向的结点的位置,数组下标 int adjve...原创 2019-10-11 09:34:11 · 200 阅读 · 0 评论