All mock tests are FREE till 31 December — register to save your progress

The correct sequence of constructing a Huffman tree is
A. Repeat until root formed
B. Create leaf nodes
C. Build priority queue
D. Combine lowest frequency nodes
Choose the correct answer from the options given below:

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

Show answer & explanation

Correct answer: C. B, C, D, A

Explanation

Create a leaf node for each symbol, put them in a min-priority queue, repeatedly combine the two lowest-frequency nodes, and repeat until a single root remains: B, C, D, A.

More Data Structures and Algorithms questions