随笔分类 -  c

摘要:1、邻接矩阵的定义和初始化 #include<stdio.h> #include<malloc.h> #include<assert.h> #define Default_Vertices_Size 10 //顶点 #define T char //无向不带权的图 typedef struct Gr 阅读全文
posted @ 2024-09-29 08:43 颜欢兮 阅读(27) 评论(0) 推荐(0)
摘要:1、线索化二叉树的定义和初始化 #include<stdio.h> #include<malloc.h> #include<assert.h> #define ElemType char typedef struct BinTreeNode{ ElemType data; struct BinTre 阅读全文
posted @ 2024-09-29 08:41 颜欢兮 阅读(15) 评论(0) 推荐(0)
摘要:1、二叉树的定义和初始化 //二叉树节点定义 typedef struct BinTreeNode{ ElemType data; struct BinTreeNode* leftChild; struct BinTreeNode* rightChild; }BinTreeNode; //二叉树定义 阅读全文
posted @ 2024-09-29 08:39 颜欢兮 阅读(38) 评论(0) 推荐(0)
摘要:1、链队 #include<stdio.h> #include<malloc.h> #include<assert.h> #define ElemType int typedef struct QueueNode{ ElemType data; struct QueueNode* next; }Qu 阅读全文
posted @ 2024-09-16 15:48 颜欢兮 阅读(21) 评论(0) 推荐(0)
摘要:1、顺序栈 #include<stdio.h> #include<malloc.h> #include<assert.h> #define ElemType int #define STACK_INIT_SIZE 8 #define STACK_INC_SIZE 3 //顺序栈的定义 typedef 阅读全文
posted @ 2024-09-16 15:45 颜欢兮 阅读(21) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<assert.h> #include<malloc.h> typedef int ElemType; typedef struct Node{ ElemType data; struct Node* prior; struct Node* nex 阅读全文
posted @ 2024-09-16 15:44 颜欢兮 阅读(22) 评论(0) 推荐(0)
摘要:1、代码实现 #include<stdio.h> #include<malloc.h> #include<assert.h> typedef int ElemType; typedef struct Node{ ElemType data; struct Node* next; }Node,*PNo 阅读全文
posted @ 2024-09-14 09:19 颜欢兮 阅读(24) 评论(0) 推荐(0)
摘要:1、静态链表初始化 head指向-1代表当前为空链表,pool指向下一个可用空间(在数组下标为2的空间),2指向3,3指向4,最后的指向0表示没有下一个节点,以此链接起来。 2、实现代码 #include<stdio.h> #include<malloc.h> #define MAX_SIZE 20 阅读全文
posted @ 2024-09-13 13:37 颜欢兮 阅读(24) 评论(0) 推荐(0)
摘要:1、创建链表-无头结点 #include<stdio.h> #include<malloc.h> #include<assert.h> typedef int ElemType; //定义链表 typedef struct ListNode{ ElemType data; struct ListNo 阅读全文
posted @ 2024-09-13 11:16 颜欢兮 阅读(19) 评论(0) 推荐(0)
摘要:c语言实现顺序表 阅读全文
posted @ 2024-09-09 00:00 颜欢兮 阅读(31) 评论(0) 推荐(0)
摘要:1、指针简单介绍 #include<stdio.h> int main(void){ int * p; // p是变量的名字, int * 表示p变量存放的是int类型的地址(指针变量) /* int * p 应该理解为 p 是变量名,p变量数据类型是 int * 类型,实际即使存放的是int变量地 阅读全文
posted @ 2023-06-18 16:10 颜欢兮 阅读(26) 评论(0) 推荐(0)