binary tree
-
The leaf node is equal to the number of branch nodes + 1, that is
t0 =t₂ + 1
-
The i-th layer has at most
2^(i-1)
one node -
Height is n, contains at most
2ⁿ - 1
nodes -
The number of nodes is equal to the total degree plus one, namely
t = d + 1
Full binary tree:
- has height n and contains 2ⁿ - 1 nodes
- 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
Complete binary tree:
top left fill up
-
The number of nodes is t
t/2 rounded to a small integer, if
i <= t/2
is a branch node
i >= t/2
and is a leaf node -
A complete binary tree of height n has at least
2^(n-1)
one node and
at most2ⁿ - 1
nodes -
A complete binary tree has at most one node of degree 1,
that ist₁ = 0
, ort₁ = 1
若完全二叉树有偶数(2k)个节点,则必有 t0 = k, t₁ = 1, t₂ = k-1 若完全二叉树有奇数(2k-1)个节点,则必有 t0 = k, t₁ = 0, t₂ = k-1
-
Find the height of the complete binary tree
n = ㏒₂(t+1)
, round up or
round downn = ㏒₂t+1