- 19
- 0
- 约3.38千字
- 约 7页
- 2020-04-28 发布于四川
- 举报
树和二叉树
树和二叉树
实验七 哈夫曼编码
哈夫曼编码
1. 问题描述
设某编码系统共有n个字符,使用频率分别为{w1, w2, …, wn},设计一个不等长的编码方案,使得该编码系统的空间效率最好。
2. 基本要求
⑴ 设计数据结构;
⑵ 设计编码算法;
⑶ 分析时间复杂度和空间复杂度。
3. 编码
#includeiostream
#includestring.h
using namespace std;
const int Size=10,Size1=50;
struct element
{
int weight;
int lchild,rchild,parent;
};
ch
原创力文档

文档评论(0)