Basic concepts:
1. A path is a branching sequence from one node to another, and the path length refers to the number of branches that pass from one node to another node.
2, in real life, we give each node the actual meaning of the real number, called the real number is the right node . In the tree structure, the path length of the root to a node is called the weighted path length of the node.
3. the length of the tree's weighted path is the sum of the length of the weighted path of all the leaf nodes in the tree.
For example, the weights of C are 7,5,2,4 respectively. Path length is the number of layers-1 that is, the length of the root node
Huffman Tree :
Huffman Tree is also called the optimal binary tree, which is composed of n-weighted leaf nodes of all the two-fork tree with a weighted path length WPL the shortest two-fork tree.
The structure of Huffman tree:
Hover slow coding, computer instructions, etc. if you want to achieve the variable length encoding must satisfy: any one encoding can not be the prefix of other encodings, the encoding to meet this condition is called prefix encoding .
Using the Harley Slow tree code:
Huffman Tree Learning