All mock tests are FREE till 31 December — register to save your progress
Unit 7 · Data Structures and Algorithms Paper 2 CS · December 2022 (Shift 1)

Given six weights 4, 15, 25, 5, 8, 16, construct a 2-tree (binary tree). What is the minimum weighted path length?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: B. 172

Explanation

Huffman merges: 4 + 5 = 9; 8 + 9 = 17; 15 + 16 = 31; 17 + 25 = 42; 31 + 42 = 73. The weighted path length is the sum of the internal nodes: 9 + 17 + 31 + 42 + 73 = 172.

More Data Structures and Algorithms questions