Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the properties of binary trees?

Shulou Source: shulou.com Published: 2022-06-02 10:58:14 10月03日 Update

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.

Tags: Nodes properties children points content depth at most maximum parents leaves integers more knowledge articles terminals absolute values industry information information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Xiaomi Shulou Tech Info OPPO Reno Apple