09 2024 档案
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; //二叉树定义
11、稀疏矩阵的压缩存储
摘要:1、稀疏矩阵的压缩存储定义和初始化 #include<stdio.h> #include<stdlib.h> #include<malloc.h> #include<assert.h> #include<memory.h> #define ElemType int #define MAXSIZE 1
10、广义表
摘要:1、广义的定义和初始化 #include<stdio.h> #include<malloc.h> #include<string.h> #include<assert.h> #include<stdlib.h> #define ATOM_TYPE int typedef enum { HEAD, A
9、串的堆分配方式
摘要:1、代码实现 #include<stdio.h> #include<malloc.h> #include<assert.h> #include<string.h> typedef struct HeapString{ char* ch; int length; }HString; //初始化 voi
8、串的顺序存储
摘要:1、代码实现 #include<stdio.h> #include<malloc.h> #include<assert.h> #include<string.h> //"abcdef" => "abcdef/0 // 用数组第一个空间存储字符串长度 5 a b c e f #define MAX_S
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