Two-fork Tree-node analysis

Source: Internet
Author: User

Learn by problem:

There are 18 nodes in a binary tree with a degree of 2, then the two fork tree has

Property 1:

The number of terminal nodes (leaf nodes) of a binary tree is equal to two branch nodes plus 1. Assuming that the terminal node in the binary tree is n0, the single branch node is N1, the double branch node is N2, the sum of the binary tree is n, because all nodes in the binary tree are less than or equal to 2, so there are: n=n0+n1+n2; On the other hand, The number of branches (that is, the degree) of all nodes in a binary tree should be equal to a single branch node plus twice double branch nodes, or n1+2xn2. By the nature of the tree 1, there are: n=n1+2xn2+1. According to the above two formulas, we can conclude that the following equation is established: n0+n1+n2= n1+2xn2+1 , so n0=n2+1.

The nodes with the degree of 0, 1 and 2 are x, Y, Z, and two forks are s=2z+y+1 or s=x+y+z, and the number of nodes is Z+1=x, which is 2 less than the leaf node tree.

Property 2:

2 of nodes are less 1,18+1=19 than leaf knot points

Two-fork Tree-node analysis

Related Article

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.