当前位置:网站首页>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 .
边栏推荐
- HDU ACM 4578 Transformation->段树-间隔的变化
- 1200.Minimum Absolute Difference
- 杰理之播内置 flash 提示音控制播放暂停【篇】
- Install torch 0.4.1
- R数据分析:cox模型如何做预测,高分文章复现
- Cocos2d-x box2d physical engine compilation settings
- Decoration design enterprise website management system source code (including mobile source code)
- Lingyun going to sea | yidiantianxia & Huawei cloud: promoting the globalization of Chinese e-commerce enterprise brands
- netperf 而网络性能测量
- What about SSL certificate errors? Solutions to common SSL certificate errors in browsers
猜你喜欢

从0开始创建小程序

腾讯云原生数据库TDSQL-C入选信通院《云原生产品目录》
![Jericho turns on the display icon of the classic Bluetooth hid mobile phone to set the keyboard [chapter]](/img/f4/8464bf9b66a1215265ac873f286688.png)
Jericho turns on the display icon of the classic Bluetooth hid mobile phone to set the keyboard [chapter]

Mathematical induction and recursion

Laravel php artisan 自动生成Model+Migrate+Controller 命令大全

Flutter3.0了,小程序不止于移动应用跨端运行

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

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

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

21.(arcgis api for js篇)arcgis api for js矩形采集(SketchViewModel)
随机推荐
枚举通用接口&枚举使用规范
Jerry's phonebook acquisition [chapter]
[untitled]
Shell programming basics
体会设计细节
LAB1配置脚本
Another million qubits! Israel optical quantum start-up company completed $15million financing
2022.6.28
迷失在MySQL的锁世界
“去虚向实”大潮下,百度智能云向实而生
20.(arcgis api for js篇)arcgis api for js面采集(SketchViewModel)
The first symposium on "quantum computing + application of financial technology" was successfully held in Beijing
Codeforces round 264 (Div. 2) C gargari and Bishop [violence]
25.(arcgis api for js篇)arcgis api for js线修改线编辑(SketchViewModel)
Jerry's RTC clock development [chapter]
杰理之关于 DAC 输出功率问题【篇】
How does C language (string) delete a specified character in a string?
About Confidence Intervals
杰理之开 BLE 退出蓝牙模式卡机问题【篇】
The latest 2022 review of "small sample deep learning image recognition"