Question

When implementing Huffman Coding, a common issue arises if the generated codes are not unique prefixes (i.e., one code is a prefix of another, leading to ambiguity during decoding). What step in the Huffman tree construction process, if implemented incorrectly, could lead to this debugging problem?

A Not sorting the initial character frequencies.
B Incorrectly combining the two lowest frequency nodes into a new parent node.
C Assigning '0' to the left child and '1' to the right child during tree traversal.
D Failing to use a priority queue to manage the nodes.
E Not handling characters with zero frequency.
Practice Next

Hey! Ask a query

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)