![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构C语言
独憩
这个作者很懒,什么都没留下…
展开
-
平衡二叉树(AVL树)C语言实现
#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"typedef struct Node /* 结点结构 */{ int data; /* 结点数据 */ int balance; /* 结点的平衡因子 */ struct Node* lchild, * rchild; /* 左右孩子指针 */} Node, *Tree;int r_rotate(Tree* T).原创 2022-05-11 22:58:33 · 580 阅读 · 0 评论 -
二叉排序树C语言实现
#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"#define maxlen 100 /* 存储空间初始分配量 */typedef int Status; /* Status是函数的类型,其值是函数结果状态代码,如OK等 *//* 二叉树的二叉链表结点结构定义 */typedef struct Node /* 结点结构 */{ int data; /* 结点数据 */.原创 2022-05-06 00:26:06 · 1062 阅读 · 0 评论 -
静态查找C语言实现
#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"#define maxlen 100int F[100];int sequential_Search(int* a, int n, int key)//从头部开始查找{ int i; for (i = 1;i <= n;i++) { if (a[i] == key) { return i; } .原创 2022-05-05 16:38:51 · 950 阅读 · 0 评论 -
二叉树链式结构C语言实现
#include "string.h"#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"#define maxlen 100 /* 存储空间初始分配量 *//* 用于构造二叉树********************************** */int index1 = 1;typedef char String[24]; /* 0号单元存放串的长度 */Str.原创 2022-05-05 10:40:50 · 223 阅读 · 0 评论 -
二叉树顺序结构C语言实现
主要针对二叉树的顺序结构完成功能:前序遍历,中序遍历,后序遍历,按层与位数得到与改变数值#define _CRT_SECURE_NO_WARNINGS#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"#define maxlen 100typedef int Tree[maxlen]; /* 0号单元存储根结点 */int InitTree(Tree T){.原创 2022-05-04 15:48:56 · 1303 阅读 · 0 评论 -
串的模式识别:朴素算法、KMP算法与其改进版C语言实现
next数组代码不知道什么意思看:KMP算法之求next数组代码讲解_哔哩哔哩_bilibili#include "string.h"#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"#define maxlen 40 /* 存储空间初始分配量 */typedef char String[maxlen + 1]; /* 0号单元存放串的长度 */int inde.原创 2022-05-03 23:19:01 · 235 阅读 · 0 评论 -
链队列C语言实现
#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"typedef struct QNode /* 结点结构 */{ int data; struct QNode* next;}QNode;typedef struct /* 队列的链表结构 */{ QNode *front, *rear; /* 队头、队尾指针 */}LinkQueue;int initQ.原创 2022-05-01 23:21:19 · 562 阅读 · 0 评论 -
顺序队列C语言实现
#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"#define maxlen 20typedef struct{ int data[maxlen]; int front; /* 头指针 */ int rear; /* 尾指针,若队列不空,指向队列尾元素的下一个位置 */}sqQueue;int initqueue(sqQueue* Q){ Q->fr.原创 2022-05-01 22:43:17 · 1071 阅读 · 0 评论 -
链栈C语言实现
#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"typedef struct StackNode //栈中的每个节点{ int data; struct StackNode* next;}StackNode;typedef struct //栈{ StackNode* top;//栈的顶节点,是一个指向节点的地址 int count;}linkstack;.原创 2022-05-01 17:59:22 · 540 阅读 · 0 评论 -
两栈共享空间C语言实现
一次性定义两个栈第一个栈的栈顶 top1 从-1开始递增第二个栈的栈顶 top2 从maxlen开始递减共享的意思是可以共享存储空间,即top1可以到maxlen-1,top2可以到0栈满的标志是:top1+1 = top2#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"#define maxlen 20 /* 存储空间初始分配量 *//* 两栈共享空间.原创 2022-04-30 23:10:28 · 359 阅读 · 0 评论 -
顺序栈C语言实现
#include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"#define maxlen 20typedef struct{ int data[maxlen]; int top;}stacklist;int push(stacklist* L, int value){ if (L->top == maxlen - 1) { printf("栈已满\n"); re.原创 2022-04-30 22:31:17 · 165 阅读 · 0 评论 -
静态链表C语言实现
#include "string.h"#include "ctype.h" #include "stdio.h" #include "stdlib.h" #include "math.h" #include "time.h"#define maxlen 1000typedef struct node{ int data; int cur; /* 游标(Cursor) ,为0时表示无指向 */} node, StaticLinkList[ma.原创 2022-04-29 23:00:35 · 724 阅读 · 0 评论 -
线性表链式结构C语言实现
#include "stdio.h" #include "string.h"#include "ctype.h" #include "stdlib.h" #include "math.h" #include "time.h"typedef struct node{ int data; struct node* next;}node;int get_data(node *L, int i) //list L 可以看成链表的头指针{ int j.原创 2022-04-26 22:51:36 · 850 阅读 · 0 评论