摘要: 4.2c 哈夫曼编码_代码_哔哩哔哩_bilibili // 哈夫曼编码译码 #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_CHAR 128 #define MAXN 256 // 哈夫曼树结点定义 ty 阅读全文
posted @ 2026-10-07 07:02 董晓 阅读(3) 评论(0) 推荐(0)
摘要: 4.1b 堆的构建_哔哩哔哩_bilibili // 大根堆的实现 #include<stdio.h> #include<stdlib.h> #define MAXN 1000 // 大根堆定义 typedef struct{ int elem[MAXN]; //元素数组 int len; //堆的 阅读全文
posted @ 2026-10-04 07:02 董晓 阅读(11) 评论(0) 推荐(0)
摘要: 4.1a 堆的插入和删除_哔哩哔哩_bilibili P3378 【模板】堆 - 洛谷 // P3378【模板】堆 - 洛谷 // 小根堆模板 #include<stdio.h> #include<stdlib.h> #define N 1000005 int H[N],len; //堆数组,堆大小 阅读全文
posted @ 2026-10-03 07:05 董晓 阅读(6) 评论(0) 推荐(0)
摘要: 3.3 树和森林的遍历_哔哩哔哩_bilibili // 树的先根遍历 // 若树非空,先访问根结点,再依次对每棵子树进行先根遍历;(与对应二叉树的先序遍历序列相同) // 树的先根遍历序列与这棵树相应二叉树的先序序列相同 void PreOrder(TreeNode *R){ if(R!=NULL 阅读全文
posted @ 2026-10-02 07:03 董晓 阅读(7) 评论(0) 推荐(0)
摘要: 3.1 树的存储结构_哔哩哔哩_bilibili //双亲表示法(顺序存储) #include<stdio.h> #include<stdlib.h> #include<stdbool.h> #define MAXN 100 //最大结点数 //树结点的定义 typedef struct{ char 阅读全文
posted @ 2026-09-30 07:02 董晓 阅读(9) 评论(0) 推荐(0)
摘要: 2.4c 先后序线索二叉树_代码_哔哩哔哩_bilibili //先序线索二叉树 #include<stdio.h> #include<stdlib.h> #include<stdbool.h> typedef struct ThreadNode{ char data; struct ThreadN 阅读全文
posted @ 2026-09-29 07:02 董晓 阅读(8) 评论(0) 推荐(0)
摘要: 2.4b 中序线索二叉树_代码_哔哩哔哩_bilibili //中序线索二叉树 #include<stdio.h> #include<stdlib.h> #include<stdbool.h> // 线索二叉树结点的定义 typedef struct ThreadNode{ char data; s 阅读全文
posted @ 2026-09-28 07:02 董晓 阅读(6) 评论(0) 推荐(0)
摘要: 2.3c 由遍历序列构造二叉树_哔哩哔哩_bilibili 105. 从前序与中序遍历序列构造二叉树 - 力扣(LeetCode) 106. 从中序与后序遍历序列构造二叉树 - 力扣(LeetCode) //C struct TreeNode* buildTree(int* preorder, in 阅读全文
posted @ 2026-09-26 07:02 董晓 阅读(8) 评论(0) 推荐(0)
摘要: 2.3b 二叉树的层序遍历_哔哩哔哩_bilibili // 二叉树的层序遍历(使用链式队列) #include<stdio.h> #include<stdlib.h> #include<stdbool.h> //定义二叉树的结点 typedef struct BiTNode{ char data; 阅读全文
posted @ 2026-09-25 07:02 董晓 阅读(11) 评论(0) 推荐(0)
摘要: 2.3a 二叉树的先中后序遍历_哔哩哔哩_bilibili //二叉树的递归遍历 #include<stdio.h> #include<stdlib.h> #include<stdbool.h> //二叉树结点定义 typedef struct BiTNode{ char data; //数据域 s 阅读全文
posted @ 2026-09-24 07:02 董晓 阅读(13) 评论(0) 推荐(0)