数据结构
元平
千里之行,始于足下
展开
-
C语言链式栈
#include<stdio.h> #include<stdlib.h> struct Node{ char data; struct Node* next; }; struct stack{ struct Node* stackTop; int size; }; struct Node* createNode(char data){ struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));原创 2020-08-03 14:50:16 · 168 阅读 · 0 评论 -
c语言数据结构——顺序栈
C语言实现顺序栈: 1.栈定义 2. 初始化 3. 元素入栈 4. 元素出栈 5. 栈元素遍历 6. 栈清空 #include<stdlib.h> #include<string.h> #include<math.h> #define MAXSIZE 100 #define ElemType char typedef struct{ ElemType data[100]; int top; }stack; //定义一个栈初始化方法 void initSta原创 2020-07-27 14:42:18 · 156 阅读 · 0 评论 -
C语言数据结构——双向循环链表
双向循环链表,就是在单链表的基础上加了一个前驱指针,链表首尾相连。 编译器:vc6 #include<stdio.h> #include<stdlib.h> //定义双向链表结构体 typedef struct student{ int score; struct student *next,*prio; } LinkList; //定义一个创建双向链表的方法 /* 传入链表长度 返回链表指针 */ LinkList *CreatLinkList(int n){原创 2020-07-25 22:59:34 · 315 阅读 · 0 评论 -
C语言线性数据结构——单链表的操作
在上一篇博客的基础上,我们继续深入学习线性数据结构,今天主要用c语言实现了单链表的增-删-改-查,创建链表时分别使用了头插法和尾插法,查询分为按值查询与链表序号查询。 编译:vc6 #include<stdio.h> #include<stdlib.h> //定义链表结构体 typedef struct student{ int score; struct student *next; } LinkList; //定义一个创建节点的函数 尾插法 LinkList *原创 2020-07-25 14:37:31 · 148 阅读 · 0 评论 -
C语言线性数据结构
C语言线性数据结构 最近在学习数据结构 写博客记录一下,很久没写过c语言了,也是现学现用。 线性表的顺序存储结构 *顺序表的三个属性: 1.存储空间的起始位置(数组名data) 2.顺序表最大存储容量(MaxSize) 3.顺序表当前的长度(length) 编译器为vc6 // 头文件 #include <stdio.h> #include <stdlib.h> #include <malloc.h> #include "windows.h" #define M原创 2020-07-24 17:17:07 · 388 阅读 · 0 评论