What are the properties of binary trees?
Today, I will talk to you about the nature of binary tree, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can gain something according to this article.
Property 1: there are at most 2 ^ (iMel 1) nodes (I > = 1) on the I layer of the binary tree. With regard to property 1, it refers to the maximum number of nodes in a certain layer of the binary tree.
Property 2: a binary tree with a depth of k has at most 2 ^ k-1 nodes. Property 2 refers to the maximum number of nodes of the entire binary tree.
Property 3: for any binary tree T, if the number of terminal nodes is n 0 and the number of nodes with degree 2 is n 2, then n 0 = n 2 + 1.
Property 4: the depth of a complete binary tree with n nodes is [log2N] + 1 (the absolute value of | x | represents the largest integer not greater than x).
Property 5: if a complete binary tree with n nodes (its depth is [log2N] + 1) is numbered sequentially (from layer 1 to layer [log2N] + 1, each layer is from left to right), for any node I (1n, then node I has no left child (node I is a leaf node); otherwise, the left child is node 2i.
If 2i+1 > n, the node has no right child; otherwise, the right child is the node 2i+1.
After reading the above, do you have any further understanding of the nature of the binary tree? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.