
数据结构
既然如此先吃饭吧
花满渚,酒满瓯,万顷波中得自由。
展开
-
BST树
二叉查找树(BST树)的构建、查找、插入、删除操作BST(二叉搜索/排序树)类模板的实现#include <stdio.h>#include <malloc.h>#include <stdlib.h>#include <string.h>typedef int Key;typedef struct BstNode { BstNod...原创 2020-04-08 18:15:26 · 292 阅读 · 0 评论 -
二叉树
#include <stdio.h>#include <string.h>#include <malloc.h>#include <stdlib.h>#include <iostream>#include <stack>#include <queue>using namespace std;#d...原创 2020-04-07 12:45:06 · 194 阅读 · 0 评论 -
串
#include <stdio.h>#include <string.h>#include <stdlib.h>#define MAXSIZE 40typedef char String[MAXSIZE + 1];bool StrAssign(String T, char* chars)//生成值为chars的串{if (strlen(chars)...原创 2020-04-01 16:40:14 · 299 阅读 · 1 评论 -
双端队列
deque 即双端队列(deque,全名double-ended queue)是一种具有队列和栈的性质的数据结构。双端队列中的元素可以从两端弹出,其限定插入和删除操作在表的两端进行。结构体定义及初始化typedef int T;typedef struct DoubleQuene{ T data[MAXSIZE]; int front;//头位置 int rear;//尾位置}*...原创 2020-04-01 10:58:48 · 378 阅读 · 0 评论 -
链队列
#include <stdio.h>#include <malloc.h>typedef int T;typedef struct QNode{ T data;//数据 QNode* next;//指向下一结点}*Node;typedef struct { Node front, rear;//头、尾指针 int count;//计数器}*Li...原创 2020-03-31 14:42:39 · 171 阅读 · 0 评论 -
链栈
#include <stdio.h>#include <malloc.h>#include <stdlib.h>typedef int T;typedef struct StackNode{ T data;//数据 StackNode* next;//指向下一结点}*LinkStackNode;typedef struct{ LinkS...原创 2020-03-31 14:42:04 · 193 阅读 · 0 评论 -
两个栈共用空间
#include <stdio.h>#include <malloc.h>#define MAXSIZE 20typedef int T;typedef struct DoubleStack{ T data[MAXSIZE]; int top1;//头 int top2;//尾}*dostack;bool InitStack(dostack s)/...原创 2020-03-31 14:41:32 · 316 阅读 · 0 评论 -
循环队列
#include <stdio.h>#include <malloc.h>#define MAXSIZE 20typedef int T;typedef struct Quene{ T data[MAXSIZE]; int front;//头位置 int rear;//尾位置}*quene;bool InitQuene(quene q)//初始化...原创 2020-03-31 14:40:49 · 220 阅读 · 0 评论 -
静态链表
#include <stdio.h>#define MAXSIZE 20typedef int T;typedef struct{ T data; int cur;}StaticList[MAXSIZE];int LengthList(StaticList L)//数据个数{ int i = 0; int j = L[MAXSIZE - 1].cur; w...原创 2020-03-30 21:05:15 · 181 阅读 · 0 评论 -
链表相关面试题
结构体typedef int T;typedef struct Node { T data; Node* next;}*node;typedef struct Node *LinkList;1.单链表的逆置Node* Reverse(Node *Head)//单链表的逆置{ Node *p, *q, *r; p = Head; q = NULL; r = NULL;...原创 2020-03-30 19:29:32 · 192 阅读 · 0 评论 -
单链表
#include <stdio.h>#include <malloc.h>typedef int T;typedef struct Node { T data; Node* next;}*node;typedef struct Node *LinkList;LinkList InitList()//初始化链表{ LinkList List = (L...原创 2020-03-30 12:08:39 · 170 阅读 · 0 评论 -
顺序栈(C和C++)
不可变长的顺序栈,没有详细的讲解主函数中的是测试代码,可以根据需要删改C语言#include <stdio.h>#include <stdlib.h>#include <assert.h>#include <string.h>#include <time.h>#include <malloc.h>#defi...原创 2019-11-11 11:59:21 · 204 阅读 · 0 评论 -
顺序表 C\C++
C#include <stdio.h>#include <stdlib.h>#include <string.h>#include <malloc.h>#define MAXSIZE 1024typedef int T;typedef struct sqlist{ T data[MAXSIZE]; int leg...原创 2019-11-19 20:45:52 · 165 阅读 · 0 评论