随笔分类 -  数据结构与算法(C语言实现)

这阵子学一学数据结构,数据结构是程序员的基本功,也是大学计算机必修课之一。所以呢,也想通过学习把基本的数据结构和算法实现一遍,供大家参考。至于为什么用c,其实一开始想用python的。但是,我个人觉得通过c能更好的看透数据结构,就是因为它的指针,能直接操作系统存储,而其他的语言的话好多结构都已经封装好了,这样就感觉差那么点意思,所以我还是选择了c。
带头节点双向链表实现
摘要:#include <stdio.h> #include <stdlib.h> #define Elemtype int #define ERROR -1 /* 带头节点的双向链表循环实现 */ typedef struct Node { Elemtype e; Node* next; Node* f 阅读全文
posted @ 2024-01-08 10:41 Rabbit_XIN 阅读(21) 评论(0) 推荐(0)
循环单链表实现
摘要:#include <stdio.h> #include <stdlib.h> #define Elemtype int #define ERROR -1 /* 循环链表实现 */ typedef struct Node { Elemtype e; Node* next; }Node,*LinkLis 阅读全文
posted @ 2024-01-05 22:36 Rabbit_XIN 阅读(21) 评论(0) 推荐(0)
带头指针单向链表实现线性结构
摘要:#include <stdio.h> #include <stdlib.h> #define Elemtype int #define ERROR -1 typedef struct Node { Elemtype e; Node* next; }Node,*LinkList; void InitL 阅读全文
posted @ 2024-01-04 11:22 Rabbit_XIN 阅读(13) 评论(0) 推荐(0)
顺序表动态数组实现
摘要:#include <stdio.h> #include <stdlib.h> #include "ConsoleApplication1.h" // Use dynamic array to create list #define MaxSize 100 #define AddSize 10 #de 阅读全文
posted @ 2023-12-24 21:54 Rabbit_XIN 阅读(25) 评论(0) 推荐(0)
顺序表实现
摘要:// ConsoleApplication1.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include <stdio.h> #define MaxSize 100 #define Elemtype int typedef struct { Elemtype L 阅读全文
posted @ 2023-12-21 16:14 Rabbit_XIN 阅读(17) 评论(0) 推荐(0)
队列链表实现
摘要:队列没有元素是 Front Rear指向NULL 只有一个元素时 都指向那一个元素 因为既是第一个元素也是最后一个元素 即队头队尾 Front指向第一个元素 Rear指向最后一个元素 #include <stdlib.h> #include <stdio.h> #include <stdbool.h 阅读全文
posted @ 2022-11-13 21:54 Rabbit_XIN 阅读(20) 评论(0) 推荐(0)
循环队列顺序表实现
摘要:#include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <math.h> /** 循环队列的顺序存储实现 队列头在队列第一个元素前 不指向元素 队列尾是指向队列最后一个元素 */ #define ERROR -1 #d 阅读全文
posted @ 2022-11-13 20:01 Rabbit_XIN 阅读(50) 评论(0) 推荐(0)
简单计算器
摘要:思路 将中缀表达式转化为后缀表达式处理 数据结构 栈 注 目前只适用 10以内的带括号的 +-*/^ 运算 #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <math.h> #define ElementTyp 阅读全文
posted @ 2022-11-12 21:51 Rabbit_XIN 阅读(50) 评论(0) 推荐(0)
栈结构的链表实现方式
摘要:#include <stdlib.h> #include <stdio.h> #include <stdbool.h> #define ElementType int #define ERROR -1 /* 用链表表示栈 该栈初始是指向一个空节点 栈插入删除操作都是在链表头部形成栈结构 栈头一直指向 阅读全文
posted @ 2022-11-11 13:09 Rabbit_XIN 阅读(23) 评论(0) 推荐(0)
堆栈顺序存储实现
摘要:#include <stdlib.h> #include <stdio.h> #include <stdbool.h> #define ElementType int #define ERROR -1 typedef int Position; struct SNode{ ElementType * 阅读全文
posted @ 2022-11-10 23:17 Rabbit_XIN 阅读(33) 评论(0) 推荐(0)
链表简单实现
摘要:#include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <time.h> /* 该链表不带头节点 第一个节点下标从0开始*/ #define ElementType int #define ERROR NULL typ 阅读全文
posted @ 2022-11-08 16:36 Rabbit_XIN 阅读(25) 评论(0) 推荐(0)
线性表_顺序表简单实现
摘要:#include <stdlib.h> #include <stdio.h> #include <stdbool.h> #define ElementType int #define MAXSIZE 100 #define ERROR -1 typedef int Position; typedef 阅读全文
posted @ 2022-11-02 22:16 Rabbit_XIN 阅读(17) 评论(0) 推荐(0)
<线性表>顺序表
摘要:#include <stdio.h> #include <stdlib.h> #define MAXSIZE 100 #define Elemtype int #define Staues int #define OVERFLOW -2 #define ERROR -1 #define OK 0 # 阅读全文
posted @ 2022-01-12 11:11 Rabbit_XIN 阅读(56) 评论(0) 推荐(0)
线性表_顺序表
摘要:/* ADT List{ 基本操作: 12个 InitList(&L) 操作结果 构造一个空的线性表L DestoryList(&L) 初始条件 线性表L已存在 操作结果 销毁线性表L ClearList(&L) 初始条件 线性表L已存在 操作结果 将L重置为空表 ListEmpyt(L) 初始条件 阅读全文
posted @ 2022-01-11 21:41 Rabbit_XIN 阅读(91) 评论(0) 推荐(0)