当前位置:网站首页>哈夫曼树基本概念
哈夫曼树基本概念
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,则从根到每个叶子的路径上,分别构成一个二进制串,该二进制串称为哈夫曼编码。
进行哈夫曼编码,先建哈夫曼树。
哈夫曼编码是前缀编码,且是最优前缀编码。
边栏推荐
- Le tube MOS réalise le circuit de commutation automatique de l'alimentation principale et de l'alimentation auxiliaire, et la chute de tension "zéro", courant statique 20ua
- Jerry's question about DAC output power [chapter]
- Under the tide of "going from virtual to real", Baidu AI Cloud is born from real
- Not All Points Are Equal Learning Highly Efficient Point-based Detectors for 3D LiDAR Point
- Lab1 configuration script
- unrecognized selector sent to instance 0x10b34e810
- Sub pixel corner detection opencv cornersubpix
- Development of wireless communication technology, cv5200 long-distance WiFi module, UAV WiFi image transmission application
- 从0开始创建小程序
- C language string sorting
猜你喜欢

如何替换模型的骨干网络(backbone)

Do you know the five most prominent advantages of E-bidding?

制作(转换)ico图标

2022.6.28

Principle of attention mechanism

20.(arcgis api for js篇)arcgis api for js面采集(SketchViewModel)

HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother

Starting from 1.5, build a micro Service Framework -- log tracking traceid

RestClould ETL 社区版六月精选问答

21.(arcgis api for js篇)arcgis api for js矩形采集(SketchViewModel)
随机推荐
RestClould ETL 社区版六月精选问答
腾讯云原生数据库TDSQL-C入选信通院《云原生产品目录》
Install torch 0.4.1
The latest 2022 review of "small sample deep learning image recognition"
Graphical tools package yolov5 and generate executable files exe
【Swift】学习笔记(一)——熟知 基础数据类型,编码风格,元组,主张
19.(arcgis api for js篇)arcgis api for js线采集(SketchViewModel)
mos管實現主副電源自動切換電路,並且“零”壓降,靜態電流20uA
leetcode
Jerry's RTC clock development [chapter]
Cryptography series: detailed explanation of online certificate status protocol OCSP
Codeforces Round #264 (Div. 2) C Gargari and Bishops 【暴力】
23.(arcgis api for js篇)arcgis api for js椭圆采集(SketchViewModel)
Make (convert) ICO Icon
Another million qubits! Israel optical quantum start-up company completed $15million financing
An error in SQL tuning advisor ora-00600: internal error code, arguments: [kesqsmakebindvalue:obj]
首届“量子计算+金融科技应用”研讨会在京成功举办
数学归纳与递归
Significance and measures of source code confidentiality
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother