Difficulty: Hard
Correct Answer: 2 * ( 2^m * (m - 2) + 2 ) / ( 2^m - 1 )
Explanation:
Introduction / Context:
In a full (perfect) binary tree with 2^m - 1 routers, a “centralized” routing rule sends any message up to the root and then down to the destination. The hop count between two routers equals the depth of the source plus the depth of the destination (since the least common ancestor is always the root). We seek the mean hop length over all pairs under this policy.
Given Data / Assumptions:
Concept / Approach:
Let D be the random variable “depth of a uniformly chosen node.” The mean path length is E[depth(I) + depth(J)] = 2 * E[D]. Hence compute the average node depth in a perfect binary tree: E[D] = (Σ k * 2^k from k=0 to m-1) / (2^m - 1). Use the identity Σ k * 2^k = 2^m * m - 2^(m+1) + 2, then double that value for the final mean path length.
Step-by-Step Solution:
Verification / Alternative check:
Test small m. For m=1 (single node): L = 0 (formula gives 0). For m=2 (3 nodes): node depths {0,1,1}, E[D] = 2/3, L = 4/3; enumerating ordered pairs via root gives the same average, validating the expression.
Why Other Options Are Wrong:
Common Pitfalls:
Forgetting that most nodes lie near the leaves, increasing mean depth; computing undirected shortest path rather than the constrained “via root” path; averaging unordered pairs and then forgetting to account for ordered pairs (the mean is the same here because the sum is symmetric).
Final Answer:
2 * ( 2^m * (m - 2) + 2 ) / ( 2^m - 1 )
Discussion & Comments