- 博客(14)
- 收藏
- 关注
原创 数据结构——无向图的最小生成树算法(Prim&Kruskal)
#include<iostream>#include<time.h>#include<Windows.h>#include< queue>using namespace std;#define NUM 100#pragma warning(disable:4996)typedef struct link{ int index; int distance; struct link *next;}*Node, node;typedef s
2021-04-24 19:06:30
2517
1
原创 数据结构——图的最短路径算法(Dijkstra&Floyd)
#include<iostream>#include<time.h>#include<Windows.h>#include< queue>using namespace std;#define NUM 100#define TURE 1#define FLASE 0#define INAVAIL -1#pragma warning(disable:4996)typedef struct link{ int index; int dis
2021-04-10 16:43:05
408
原创 数据结构——有向图和无向图的创建与遍历
#include<iostream>#include<time.h>#include<Windows.h>#include< queue>using namespace std;#define NUM 100#pragma warning(disable:4996)typedef struct link{ int index; struct link *next;}*Node,node;typedef struct Link{ ch
2021-04-02 11:36:47
3311
原创 数据结构——排序二叉树
前言下图代码是排序二叉树的相关操作的实现。众所周知,排序二叉树的优点就是插入高效,查找高效(除顺序序列插入,否则查找数据的时间复杂度都为O(logn),并且中序遍历二叉树的输出结果都是顺序序列。但在删除结点时比较复杂,接下来会对排序二叉树结点的删除做具体分析!#include<iostream>#include<time.h>#include<Windows.h>using namespace std;#define NUM 100#pragma warni
2021-03-18 15:26:50
333
原创 数据结构——线索二叉树的创建和遍历
#include<iostream>#include<time.h>#include<Windows.h>using namespace std;#define NUM 100#define BUSY 0#define REST 1#pragma warning(disable:4996)typedef struct node{ char data; struct node* lchild; struct node* rchild; int lc
2021-03-15 10:33:11
425
原创 数据结构——二叉树的创建及其基本操作
#include<iostream>#include<time.h>#include<Windows.h>using namespace std;#define SIZE 100#pragma warning(disable:4996)typedef struct node{ char data; struct node* lchild; struct node* rchild;}*TNode,Tnode;TNode createtree();/
2021-03-11 21:21:52
1486
原创 数据结构——字符串匹配算法(BF&KMP)
#include<iostream>#include<time.h>#include<Windows.h>using namespace std;#define SIZE 100#pragma warning(disable:4996)int BFmatch(char a[], char b[]);//BF算法字符串匹配int KMPmatch(char a[], char b[],int next[]);//KMP算法字符串匹配void getnext(
2021-02-28 17:52:19
251
2
原创 数据结构——链式循环队列
#include<iostream>#include<math.h>using namespace std;#define SIZE 10#pragma warning(disable:4996)typedef struct l{ char data; struct l* next;}node;typedef struct I{ node *front; node *rear;}List;void openlist(List &L);//初始化队
2021-02-03 16:15:32
298
原创 数据结构——顺序循环队列
#include<iostream>#include<time.h>#include<Windows.h>using namespace std;#define SIZE 100#pragma warning(disable:4996)typedef struct l{ char *p; int front; int rear;}List;void openlist(List &L);//初始化队列void insertlist(List
2021-02-03 16:12:44
83
原创 数据结构——栈的顺序存储
#include<iostream>#include<math.h>using namespace std;#define SIZE 10#pragma warning(disable:4996)typedef struct l{ char *base; char *top; int listmax;}List;void openlist(List &L);//初始化栈void insertlist(List &L, char a);//进栈
2021-02-03 16:10:03
106
原创 关于线性表(顺序表&链表)的合并问题
文章目录一、在顺序表中实现两个有序的稀疏多项式相加二、在链表中将两个有序链表合并成一个有序链表一、在顺序表中实现两个有序的稀疏多项式相加代码如下:#include<iostream>#include<math.h>using namespace std;#define NUM 10#pragma warning(disable:4996)typedef struct student{ int name; int num;}stu;typedef str.
2021-01-31 22:22:34
1041
原创 单向链表中的数据排序问题
文章目录前言一、单向链表中数据排序问题的解决方案二、方法优劣比较1.运用GetTickCount()函数来记录两种方法在同一长度链表排序中的时间2.记录结果和比较总结前言在利用单链表做学生信息管理系统的时候发现了一个一直忽略一个问题,就是在单链表中如何进行排序的问题,我们知道在顺序表中可以很轻易的利用冒泡排序或者归并排序等各种算法轻易实现排序,但在单链表中该如何进行排序引起了我的思考。在一番思索过后,我暂时给出了两种基本的解决方案,这两种方案我都放在了之前的一篇文章中,详细代码可以参考数据结构——(.
2021-01-26 15:44:59
1940
1
原创 数据结构——(线性表之单链表)学生信息应用
#include<iostream>using namespace std;#define NUM 100#pragma warning(disable:4996)typedef struct student{ int num; char name[10]; float score;}stu;typedef struct list{ stu data; struct list *next;}List;List* opennode();//初始化表头void ins
2021-01-25 21:46:53
747
原创 数据结构——(线性表之顺序表)学生信息应用
#include<iostream>using namespace std;#define NUM 10 #pragma warning(disable:4996)typedef struct student{ char name[20]; int num;}stu;typedef struct list//定义一个这样的访问线性表的结构体指针和测量长度的变量{ stu *p; int length;}List;void open(List &L); //初始
2021-01-25 14:53:56
1081
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人