当前位置:网站首页>Basic concepts of Huffman tree
Basic concepts of Huffman tree
2022-07-07 03:25:00 【Muzi text_ Ah】
The basic concept of Huffman tree :
(1) route : It consists of branches from one node to another
(2) The length of the path : Number of branches on the path a→d The path length of = 2
(3) The path length of the tree : The sum of the path length from the tree root to each node . Case diagram :10
(4) power : A quantity given to an entity , It is a numerical description of the attributes of entities . If the nodes of the tree have weights , That is, the weighted tree .
(5) The weighted path length of the node : The product of the path length from node to root and the weight on the node d Weighted path length =72=14
(6) Weighted path length of tree : The sum of the weighted path lengths of all leaf nodes in the tree . Case diagram :27+25+22+2*4=36
(7) Huffman tree (Huffman): The best binary tree , The tree with the smallest weighted path length
The characteristics of Huffman tree
- The path length from the node with large weight to the root node is short ;
- The path length from the node with small weight to the root node is long .
Ø There is no degree in Huffman coding tree 1 The node of ;
Ø If given n Weight (n Leaf node ), Then the total number of points of Huffman tree is 2n-1;
Ø The height of Huffman tree does not exceed n.
The construction algorithm of Huffman tree :

Huffman code :
v Prefix encoding : The encoding of any character is not a prefix of the encoding of another character .
Such as : character a、b、c、d The codes of the two are respectively 0、1、01、10, be a The code of is c The prefix of the encoding ,b The code of is d Coded prefix , This code is not a prefix code .
When decoding , about 01011011 The decoding result of will not be unique .
v Huffman code
For a tree with n A leafy Huffman tree , Assign 0, The right branch gives 1, Then the path from the root to each leaf , Form a binary string respectively , This binary string is called Huffman code .
Do Huffman coding , Build Huffman tree first .
Huffman coding is prefix coding , And it's the best prefix code .
边栏推荐
- Lingyun going to sea | yidiantianxia & Huawei cloud: promoting the globalization of Chinese e-commerce enterprise brands
- [dream database] add the task of automatically collecting statistical information
- 华为小米互“抄作业”
- 制作(转换)ico图标
- 美国空军研究实验室《探索深度学习系统的脆弱性和稳健性》2022年最新85页技术报告
- Uniapp adaptation problem
- Don't you know the relationship between JSP and servlet?
- Intelligent static presence detection scheme, 5.8G radar sensing technology, human presence inductive radar application
- Jerry's question about DAC output power [chapter]
- 校招行测笔试-数量关系
猜你喜欢

When you go to the toilet, you can clearly explain the three Scheduling Strategies of scheduled tasks

CVPR 2022 best paper candidate | pip: six inertial sensors realize whole body dynamic capture and force estimation

Function reentry, function overloading and function rewriting are understood by yourself

leetcode

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

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

mos管實現主副電源自動切換電路,並且“零”壓降,靜態電流20uA

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

Development of wireless communication technology, cv5200 long-distance WiFi module, UAV WiFi image transmission application

Appx code signing Guide
随机推荐
小程序能运行在自有App中,且实现直播和连麦?
Hazel engine learning (V)
杰理之RTC 时钟开发【篇】
杰理之关于 DAC 输出功率问题【篇】
Flink Task退出流程与Failover机制
Leetcode-02 (linked list question)
装饰设计企业网站管理系统源码(含手机版源码)
CVPR 2022 最佳论文候选 | PIP: 6个惯性传感器实现全身动捕和受力估计
[cpk-ra6m4 development board environment construction based on RT thread studio]
杰理之在非蓝牙模式下,手机连接蓝牙不要跳回蓝牙模式处理方法【篇】
About Estimation Statistics
25.(arcgis api for js篇)arcgis api for js线修改线编辑(SketchViewModel)
HDU 4337 King Arthur's Knights 它输出一个哈密顿电路
Shell 编程基础
21.(arcgis api for js篇)arcgis api for js矩形采集(SketchViewModel)
HDU 4337 King Arthur' S Knights it outputs a Hamiltonian circuit
When you go to the toilet, you can clearly explain the three Scheduling Strategies of scheduled tasks
注意力机制原理
Open3D 网格滤波
How does C language (string) delete a specified character in a string?