TAOCP 6.2.3 Exercise 22

Let a weight-balanced tree be a binary tree in which there exists a fixed constant $0 < \alpha \le \tfrac{1}{2}$ such that for every internal node $v$ with subtree size $n(v)$, its left and right subt...

Section 6.2.3: Balanced Trees

Exercise 22. [M20] [M20] What is the analog of Theorem A, for weight-balanced trees?

Verified: no
Solve time: 1m06s


Solution

Let a weight-balanced tree be a binary tree in which there exists a fixed constant $0 < \alpha \le \tfrac{1}{2}$ such that for every internal node $v$ with subtree size $n(v)$, its left and right subtrees satisfy

$$ n(\mathrm{L}(v)) \ge \alpha n(v), \qquad n(\mathrm{R}(v)) \ge \alpha n(v). $$

Equivalently,

$$ n(\mathrm{L}(v)) \le (1-\alpha)n(v), \qquad n(\mathrm{R}(v)) \le (1-\alpha)n(v). $$

Let $h$ be the height of a weight-balanced tree with $N$ internal nodes. Let $T$ be such a tree.

Consider any path from the root to an external node. Let $v_0, v_1, \dots, v_h$ be the nodes on this path, where $v_0$ is the root and $v_h$ is an external node. Define $n_i = n(v_i)$ for $0 \le i \le h$. By the defining property of weight balance, each step from $v_i$ to its child $v_{i+1}$ satisfies

$$ n_{i+1} \le (1-\alpha)n_i. $$

Iterating this inequality yields

$$ n_h \le (1-\alpha)^h n_0. $$

Since $v_h$ is an external node, its subtree size is $n_h = 1$, while $n_0 = N+1$ in the usual extended-tree convention used in Section 6.2.3. Hence

$$ 1 \le (1-\alpha)^h (N+1), $$

so

$$ N+1 \ge (1-\alpha)^{-h}. $$

Taking logarithms,

$$ h \le \log_{1/(1-\alpha)}(N+1). $$

For the lower bound, any binary tree of height $h$ has at most $2^h$ external nodes by the argument used in Theorem A. Hence

$$ N+1 \le 2^h, $$

so

$$ h \ge \lg(N+1). $$

Combining both inequalities,

$$ \lg(N+1) \le h \le \log_{1/(1-\alpha)}(N+1). $$

This completes the proof. ∎