随笔分类 - c
14、图-邻接矩阵
摘要:1、邻接矩阵的定义和初始化 #include<stdio.h> #include<malloc.h> #include<assert.h> #define Default_Vertices_Size 10 //顶点 #define T char //无向不带权的图 typedef struct Gr
13、线索二叉树
摘要:1、线索化二叉树的定义和初始化 #include<stdio.h> #include<malloc.h> #include<assert.h> #define ElemType char typedef struct BinTreeNode{ ElemType data; struct BinTre
12、二叉树
摘要:1、二叉树的定义和初始化 //二叉树节点定义 typedef struct BinTreeNode{ ElemType data; struct BinTreeNode* leftChild; struct BinTreeNode* rightChild; }BinTreeNode; //二叉树定义
7、队列
摘要:1、链队 #include<stdio.h> #include<malloc.h> #include<assert.h> #define ElemType int typedef struct QueueNode{ ElemType data; struct QueueNode* next; }Qu
6、栈
摘要:1、顺序栈 #include<stdio.h> #include<malloc.h> #include<assert.h> #define ElemType int #define STACK_INIT_SIZE 8 #define STACK_INC_SIZE 3 //顺序栈的定义 typedef
5、循环双链表
摘要:#include<stdio.h> #include<assert.h> #include<malloc.h> typedef int ElemType; typedef struct Node{ ElemType data; struct Node* prior; struct Node* nex
4、循环单链表
摘要:1、代码实现 #include<stdio.h> #include<malloc.h> #include<assert.h> typedef int ElemType; typedef struct Node{ ElemType data; struct Node* next; }Node,*PNo
3、静态链表
摘要:1、静态链表初始化 head指向-1代表当前为空链表,pool指向下一个可用空间(在数组下标为2的空间),2指向3,3指向4,最后的指向0表示没有下一个节点,以此链接起来。 2、实现代码 #include<stdio.h> #include<malloc.h> #define MAX_SIZE 20
2、链表
摘要:1、创建链表-无头结点 #include<stdio.h> #include<malloc.h> #include<assert.h> typedef int ElemType; //定义链表 typedef struct ListNode{ ElemType data; struct ListNo
C语言:指针
摘要:1、指针简单介绍 #include<stdio.h> int main(void){ int * p; // p是变量的名字, int * 表示p变量存放的是int类型的地址(指针变量) /* int * p 应该理解为 p 是变量名,p变量数据类型是 int * 类型,实际即使存放的是int变量地