Full binary tree and full Binary Tree

Source: Internet
Author: User

I wrote the test many times, and each time I had questions about binary trees, the most of which was about the full binary tree. However, the form of the full binary tree has been very vague in my brother's mind, the reason is that I mixed the full binary tree with the full binary tree. In fact, a full Binary Tree is a special case of A Complete Binary Tree, because a full binary tree is full, and does not represent full. So you should imagine it. "full" means that every node outside the leaf node has two children, and the full meaning is that the last layer is not full, not full.

The following is a post definition:

Full Binary Tree ):

No child except the last layerNodeIn addition, all nodes on each layer have two sub-nodes (the nodes without sub-nodes on the last layer areLeaf node). It can also be understood that all nodes except the leaf node have two subnodes. The number of nodes reaches the maximum value. All leaf nodes must be on the same layer.


The depth of a tree is H, the maximum number of layers is K, and the depth is the same as that of the maximum number of layers, K = h;

The number of leaves is 2 ^ h.

The number of knots at Layer K is: 2 ^ (k-1)

Sum points are: 2 ^ K-1 (2 k POWER minus one)

The total number of nodes must be odd.


Complete Binary Tree (complete
Binary Tree)

If the depth of a binary tree is set to H, in addition to layer H, other layers (1 ~ H-1) are all reached the maximum number of points, the H layer of all nodes are continuously concentrated on the leftmost, This Is The Complete Binary Tree.

The full binary tree is composedFull Binary Tree. For a binary tree with a depth of K and N nodes, it is called a Complete Binary Tree only when each of its nodes is one-to-one pairs of nodes numbered from 1 to n in a full binary tree with a depth of K.

If a binary tree has at most 2 degrees of nodes on the bottom two layers, and all the nodes on the bottom layer are concentrated on the leftmost position of the layer, the binary tree is a Complete Binary Tree.

Hoffmann tree: Do each node have no subnodes or two subnodes?



Take a look at the following questions:

A Complete Binary Tree has 770 nodes, so its leaf node is

259

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.