当前位置:网站首页>哈夫曼树基本概念
哈夫曼树基本概念
2022-07-06 20:18:00 【木子正文_啊嘞】
哈夫曼树的基本概念:
(1)路径:由一结点到另一结点间的分支所构成
(2)路径长度:路径上的分支数目a→d的路径长度= 2
(3)树的路径长度:从树根到每一结点的路径长度之和。 例图:10
(4)权:赋予某个实体的一个量,是对实体的属性的数值化描述。若树的结点带有权值,即为带权树。
(5)结点的带权路径长度:结点到根的路径长度与结点上权值的乘积d的带权路径长度=72=14
(6)树的带权路径长度:树中所有叶子结点的带权路径长度之和。例图:27+25+22+2*4=36
(7)赫夫曼树(Huffman):最优二叉树,带权路径长度最小的树
哈夫曼树的特点
- 权值大的结点到根结点的路径长度短;
- 权值小的结点到根结点的路径长度长。
Ø哈夫曼编码树中没有度为1的结点;
Ø若给定n个权值(n个叶子结点),则哈夫曼树的总结点数为 2n-1;
Ø哈夫曼树的高度不超过n。
哈夫曼树的构造算法:

哈夫曼编码:
v前缀编码:任一字符的编码都不是另一字符编码的前缀。
如:字符a、b、c、d的编码分别为0、1、01、10,则a的编码是c的编码的前缀,b的编码是d编码的前缀,该编码不是前缀编码。
在译码时,对于01011011的译码结果将不唯一。
v哈夫曼编码
对一棵具有n个叶子的哈夫曼树,对每个左分支赋予0,右分支赋予1,则从根到每个叶子的路径上,分别构成一个二进制串,该二进制串称为哈夫曼编码。
进行哈夫曼编码,先建哈夫曼树。
哈夫曼编码是前缀编码,且是最优前缀编码。
边栏推荐
- Shangsilicon Valley JVM Chapter 1 class loading subsystem
- HDU ACM 4578 Transformation->段树-间隔的变化
- Room rate system - login optimization
- SQL中删除数据
- 从 1.5 开始搭建一个微服务框架——日志追踪 traceId
- 22.(arcgis api for js篇)arcgis api for js圆采集(SketchViewModel)
- Household appliance industry under the "retail is king": what is the industry consensus?
- Mathematical induction and recursion
- Jerry's phonebook acquisition [chapter]
- Flutter3.0了,小程序不止于移动应用跨端运行
猜你喜欢

24.(arcgis api for js篇)arcgis api for js点修改点编辑(SketchViewModel)

Variables, process control and cursors (MySQL)

装饰设计企业网站管理系统源码(含手机版源码)

Principle of attention mechanism

leetcode

Lavel PHP artisan automatically generates a complete set of model+migrate+controller commands

Decoration design enterprise website management system source code (including mobile source code)

Under the tide of "going from virtual to real", Baidu AI Cloud is born from real

23.(arcgis api for js篇)arcgis api for js椭圆采集(SketchViewModel)

The solution of unable to create servlet file after idea restart
随机推荐
Stored procedures and functions (MySQL)
unrecognized selector sent to instance 0x10b34e810
Jerry's broadcast has built-in flash prompt tone to control playback pause [chapter]
Codeforces Round #264 (Div. 2) C Gargari and Bishops 【暴力】
Shell programming basics
mos管实现主副电源自动切换电路,并且“零”压降,静态电流20uA
Flink task exit process and failover mechanism
LAB1配置脚本
Depth analysis of compilation constants, classloader classes, and system class loaders
Graphical tools package yolov5 and generate executable files exe
树莓派设置静态ip
「小样本深度学习图像识别」最新2022综述
源代码保密的意义和措施
Not All Points Are Equal Learning Highly Efficient Point-based Detectors for 3D LiDAR Point
The latest 2022 review of "small sample deep learning image recognition"
图形化工具打包YOLOv5,生成可执行文件EXE
25.(arcgis api for js篇)arcgis api for js线修改线编辑(SketchViewModel)
又一百万量子比特!以色列光量子初创公司完成1500万美元融资
21.(arcgis api for js篇)arcgis api for js矩形采集(SketchViewModel)
opencv环境的搭建,并打开一个本地PC摄像头。