📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    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. Correct Answer Incorrect Answer
    B Incorrectly combining the two lowest frequency nodes into a new parent node. Correct Answer Incorrect Answer
    C Assigning '0' to the left child and '1' to the right child during tree traversal. Correct Answer Incorrect Answer
    D Failing to use a priority queue to manage the nodes. Correct Answer Incorrect Answer
    E Not handling characters with zero frequency. Correct Answer Incorrect Answer

    Solution

    The correct answer is B

    Practice Next
    ask-question