Full binary tree, complete binary tree, balanced binary tree, optimal binary tree

One, full binary tree

  The nodes of a binary tree are either leaf nodes or it has two child nodes (if a binary tree has K levels and the total number of nodes is (2^k) -1, then it is a full binary tree.)

 

 

Second, the complete binary tree

  If the depth of the binary tree is k, the number of nodes in the other layers (1~k-1) has reached the maximum except for the kth layer, and all the nodes of the kth layer are continuously concentrated on the leftmost side , which is complete Binary tree.

 

 

Three, balanced binary tree

  It is either an empty tree, or the absolute value of the difference (balance factor) between the depths of its left and right subtrees does not exceed 1, and its left and right subtrees are both a balanced binary tree.

 

 

Fourth, the optimal binary tree (Huffman tree)

  The weighted path length of the tree is the smallest, and such a binary tree is called the optimal binary tree, also known as the Huffman tree. Huffman tree is the tree with the shortest weighted path length, and the node with larger weight is closer to the root.

Combine Huffman coding to understand: https://www.cnblogs.com/-citywall123/p/11297523.html

Guess you like

Origin blog.csdn.net/sd19871122/article/details/108075490