- 博客(4)
- 收藏
- 关注
原创 05-树9 Huffman Codes
构造哈夫曼树为了实现哈夫曼算法,可以利用最小堆来储存最优解点。因此可以通过删除最小堆的根,并插入两个和来实现哈夫曼算法。因此在最小堆结构中的DATA应是指向哈夫曼树的指针数组。删除最小堆的根时也应当保留删除两个节点指向的哈夫曼树,并且做到在返回时左子树和右子树也都不为NULL。直到堆中只有一个有效元素时就说明一棵哈夫曼树生成完成了。:happy:最小堆与哈夫曼的结构typedef struct HuffmanTree * TNode;typedef struct Heap * MinHeap;st
2020-12-05 08:39:16
158
原创 04-树5 Root of AVL Tree (25分)
Root of AVL Tree知识储备树结构构建typedef struct TreeNode *Position;struct TreeNode{ int value; Position left; Position right;};AVL树四种调整方式LLrotationPosition LLrotation(Position T){ Position t; t = T->left; T->left = t-
2020-11-22 10:32:41
112
原创 Ancient Cipher C++题解
Ancient Cipher C++题解题目Ancient Roman empire had a strong government system with various departments, including a secret service department. Important documents were sent between provinces and the capital in encrypted form to prevent eavesdropping. The mo
2020-10-05 22:51:09
291
原创 C语言解决括号匹配问题
简述最近初学算法,从最基础的开始。看到算法书上提到了括号匹配问题,并没有给出解答。就自己摸索写了一下,用的是类似栈的形式,但还没有用到push和pop,看起来比较好懂一点。C代码#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAX 100struct Parenthesis{ char paren[MAX]; int top;};int main(){
2020-05-24 22:52:59
1586
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人