GATE / CS ARCHIVE

GATE CSE 1991 / QUESTION 1(viii)

Weighted external path length

Data Structures · Tree Properties & Traversals · Full GATE CSE 1991 paper

GATE 1991, Q1(viii) 2 marks · Other
Report issue

Tree Properties & Traversals

Question 1(viii), GATE 1991: Leaves of weights 2, 4, 5, 7 have depth 4; weights 9, 10 have depth 3; weight 15 has depth 1 in the source binary tree. Find its weighted external path length.
Question 1(viii), GATE 1991: Leaves of weights 2, 4, 5, 7 have depth 4; weights 9, 10 have depth 3; weight 15 has depth 1 in the source binary tree. Find its weighted external path length.
Tap to enlarge
Answer & solution

Answer: 144 (no official key was published)

External path length weights each leaf by the number of edges from the root, with root depth zero. Grouping equal depths gives 4(2+4+5+7)+3(9+10)+1(15). The sums are 4×18=72, 3×19=57, and 15, totaling 144. Internal unlabeled nodes contribute nothing to this external measure. Counting vertices instead of edges would add the sum of leaf weights, so the conventional edge-depth definition is essential. The supplied depth list is a transcription of the inspected tree, not a newly constructed tree.

Original paper, page 1