🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Rooted Trees and Huffman Coding: all 10 questions

Quiz: Rooted Trees and Huffman Coding · Question 8 of 10

In Huffman's algorithm, which two trees are merged at each step?

In Huffman's algorithm, which two trees are merged at each step?

  1. A.The two largest
  2. B.The first two in alphabetical order
  3. C.The two with the smallest weights
  4. D.One small and one large, to keep the tree balanced
Answer & explanation

Correct answer: The two with the smallest weights

Merging the lightest pair pushes the rarest characters deepest, giving them the longest codes.

Can you get the rest right without peeking?

Take the timed Quiz: Rooted Trees and Huffman Coding quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →