Skip to content
Official PYQ · 1991

GATE CS 1991 Q01 — Trees

Explain with AI

The weighted external path length of the binary tree in figure is ______

View worked solution

Answer: 144

The Weighted External Path Length (WEPL) of a binary tree is defined as the sum of the products of the weights of the external nodes (leaves) and their respective depths (distance from the root):

WEPL=∑i(wi×di)\text{WEPL} = \sum_{i} (w_i \times d_i)

From the given binary tree, we identify the weights of the leaf nodes and their corresponding depths:

  • Leaves at depth 44: weights 22 and 44
  • Leaves at depth 33: weights 55, 77, 88, and 1010
  • Leaf at depth 22: weight 1515

Substituting these values into the formula:

WEPL=(2×4)+(4×4)+(5×3)+(7×3)+(8×3)+(10×3)+(15×2)\text{WEPL} = (2 \times 4) + (4 \times 4) + (5 \times 3) + (7 \times 3) + (8 \times 3) + (10 \times 3) + (15 \times 2)WEPL=8+16+15+21+24+30+30=144\text{WEPL} = 8 + 16 + 15 + 21 + 24 + 30 + 30 = 144

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Trees questions