Binary tree, a high-frequency test site about digital computing

binary tree

  1. The leaf node is equal to the number of branch nodes + 1, that ist0 =t₂ + 1

  2. The i-th layer has at most 2^(i-1)one node

  3. Height is n, contains at most 2ⁿ - 1nodes

  4. The number of nodes is equal to the total degree plus one, namelyt = d + 1

insert image description here

Full binary tree:

  1. has height n and contains 2ⁿ - 1 nodes
  2. The sequence starts from 1, the left child of node i is 2i, the right child is 2i
    2i + 1, and the parent node isi/2

insert image description here

Complete binary tree:

top left fill up
insert image description here

  1. The number of nodes is t
    t/2 rounded to a small integer, if
    i <= t/2is a branch node
    i >= t/2and is a leaf node

  2. A complete binary tree of height n has at least 2^(n-1)one node and
    at most 2ⁿ - 1nodes

  3. A complete binary tree has at most one node of degree 1,
    that is t₁ = 0, ort₁ = 1

     	若完全二叉树有偶数(2k)个节点,则必有
     	t0 = k, t₁ = 1, t₂ = k-1
     	若完全二叉树有奇数(2k-1)个节点,则必有
     	t0 = k, t₁ = 0, t₂ = k-1
    
  4. Find the height of the complete binary tree n = ㏒₂(t+1), round up or
    round downn = ㏒₂t+1

Guess you like

Origin blog.csdn.net/pz641/article/details/127818658