数据结构
Gofor.
这个作者很懒,什么都没留下…
展开
-
数据结构KMP算法详解---C++完整代码实现
学了两天的KMP算法,总算有了自己的一点理解,写在这里做个记录了,也与各位大神交流,期待大神的指正!AC代码:#include <iostream>#include <cstring>using namespace std;#define MaxSize 255 // 串的最大长度// 串的定长顺序存储结构typedef struct{ char ch[MaxSize+1]; // 存储串的一维数组 int length; // 串原创 2021-04-16 11:06:57 · 1935 阅读 · 1 评论 -
用循环链表实现队列
AC代码:#include <iostream>#define Status int#define QElemType intusing namespace std;// 链队结点数据结构typedef struct QNode{ QElemType data; // 数据域 struct QNode *next; // 指针域}QNode, *QueuePtr;struct QNode *rear; // 队尾指针//******************原创 2021-04-11 22:51:27 · 519 阅读 · 0 评论 -
顺序栈
AC代码:#include <iostream>#define Status int#define SElemType int#define MaxSize 3using namespace std;// 栈数据结构typedef struct Stack{ SElemType *base; // 栈底指针 不变 SElemType *top; // 栈顶指针 一直在栈顶元素的上一个位置 int stacksize; // 栈可用的最大容量原创 2021-04-11 22:49:16 · 63 阅读 · 0 评论 -
链栈
AC代码:#include <iostream>#define Status int#define SElemType intusing namespace std;// 链栈数据结构typedef struct StackNode{ SElemType data; // 数据域 struct StackNode *next; // 指针域}StackNode, *LinkStack;// **********************************原创 2021-04-11 22:46:24 · 65 阅读 · 0 评论 -
循环队列
AC代码:#include <iostream>#define Status int#define QElemType int#define MaxSize 5using namespace std;// 循环队列数据结构typedef struct{ QElemType *base; // 存储空间基地址 int front; // 头指针 int rear; // 尾指针}SqQueue;// 初始化函数Status InitQueue(SqQ原创 2021-04-11 22:45:09 · 55 阅读 · 0 评论 -
链队
AC代码:#include <iostream>#define Status int#define QElemType intusing namespace std;// 链队结点数据结构typedef struct QNode{ QElemType data; // 数据域 struct QNode *next; // 指针域}QNode, *QueuePtr;typedef struct{ struct QNode *front, *rear;原创 2021-04-11 22:43:43 · 105 阅读 · 0 评论 -
标志位tag判断队空队满
AC代码:#include <iostream>#define Status int#define QElemType int#define MaxSize 5using namespace std;// 循环队列数据结构typedef struct{ QElemType *base; // 存储空间基地址 int front; // 头指针 int rear; // 尾指针 int tag = 0; // 判断队空队满的标志位}SqQueue原创 2021-04-11 22:42:22 · 204 阅读 · 0 评论 -
双栈
AC代码:#include <iostream>#define Status int#define SElemType int#define MaxSize 3using namespace std;// 双栈数据结构typedef struct{ SElemType *V; // 栈数组的基地址 SElemType *top[2]; // 栈顶指针 SElemType *bot[2]; // 栈底指针 int m; // 栈可用原创 2021-04-11 22:40:11 · 107 阅读 · 0 评论 -
数据结构--单链表
数据结构第二次更新,记录了单链表的学习,上传了包括 整表创建,插入,删除,取值,查找,获取长度,反转链表,整表销毁 等函数的代码。敲码不易,求赞,求关注,更希望大家能对我的代码多加指正,谢谢!AC代码:#include<iostream>#define ElemType int#define Status int#define OK 1using namespace std;// 单链表结点数据结构;typedef struct LNode{ ElemType原创 2021-03-24 19:17:12 · 171 阅读 · 0 评论 -
数据结构——顺序表
近4个小时写的数据结构,用c++实现的顺序表,包括一些基础操作,创建,插入,删除,清空,查找 等;谨以此文来记录我的学习,以便日后改进,加油!AC代码:#include<iostream>#define Maxsize 100#define ElemType int#define Status int#define OK 1using namespace std;// 顺序表结构;typedef struct{ ElemType *elem; int leng原创 2021-03-12 16:51:58 · 128 阅读 · 0 评论