A nonempty binary tree in which every level, including the deepest, contains all its possible vertices. Equivalently, it is a full binary tree whose leaves are all at the same graph distance from the root of a tree.[ref]
9.1 Binary trees. Data Structures and Algorithms, section 9.1.1: perfect shape, equal leaf levels, and Figure 9.4
Every perfect binary tree is both a full binary tree and a complete binary tree; the five-vertex example above shows that the converse fails even when both properties hold. These definitions fix the terminology used here.
For height of a binary tree , the level sizes are , giving by a geometric series. There are leaves. The seven-vertex example has level sizes and height of a binary tree ; the single-vertex binary tree is already perfect, with . More generally, joining two perfect binary trees of equal height of a binary tree under a fresh root of a tree gives the next such shape. Equal heights are essential: fullness alone allows unequal leaf distances. A perfect binary tree realizes the maximum number of vertices for its height of a binary tree, making the exponential capacity behind short lookup graph paths visible.
// Target: probability-and-statistics.bigb
Articles by others on the same topic
There are currently no matching articles.