当前位置:网站首页>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 .
边栏推荐
- Graphical tools package yolov5 and generate executable files exe
- How to replace the backbone of the model
- 22.(arcgis api for js篇)arcgis api for js圆采集(SketchViewModel)
- Tencent cloud native database tdsql-c was selected into the cloud native product catalog of the Academy of communications and communications
- 25.(arcgis api for js篇)arcgis api for js线修改线编辑(SketchViewModel)
- OC, OD, push-pull explanation of hardware
- 应用程序启动速度的优化
- 20.(arcgis api for js篇)arcgis api for js面采集(SketchViewModel)
- 杰理之发射端在接收端关机之后假死机【篇】
- pip只下载不安装
猜你喜欢
1200.Minimum Absolute Difference
MOS transistor realizes the automatic switching circuit of main and auxiliary power supply, with "zero" voltage drop and static current of 20ua
20.(arcgis api for js篇)arcgis api for js面采集(SketchViewModel)
The latest 2022 review of "small sample deep learning image recognition"
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
Appx代码签名指南
亚像素级角点检测Opencv-cornerSubPix
Principle of attention mechanism
[cpk-ra6m4 development board environment construction based on RT thread studio]
注意力机制原理
随机推荐
leetcode
杰理之在非蓝牙模式下,手机连接蓝牙不要跳回蓝牙模式处理方法【篇】
Jerry's broadcast has built-in flash prompt tone to control playback pause [chapter]
体会设计细节
Cocos2d-x Box2D物理引擎编译设置
Appx code signing Guide
杰理之FM 模式单声道或立体声选择设置【篇】
New benchmark! Intelligent social governance
[colmap] 3D reconstruction with known camera pose
SSL证书错误怎么办?浏览器常见SSL证书报错解决办法
Matlab Error (Matrix dimensions must agree)
The version control of 2021 version is missing. Handling method
input_delay
【Swift】学习笔记(一)——熟知 基础数据类型,编码风格,元组,主张
[swift] learning notes (I) -- familiar with basic data types, coding styles, tuples, propositions
1200.Minimum Absolute Difference
Depth analysis of compilation constants, classloader classes, and system class loaders
Laravel php artisan 自动生成Model+Migrate+Controller 命令大全
安装 torch 0.4.1
DOMContentLoaded和window.onload