practice_final_sol_haim

practice_final_sol_haim - Solutions to Practice Final 1...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Solutions to Practice Final 1. Huffman code Give a Huffman encoding into an alphabet of size D = 4 of the following probability mass function: p = ( 8 36 , 7 36 , 6 36 , 5 36 , 4 36 , 3 36 , 2 36 , 1 36 ) Solution: Huffman code (1) 8 8 15 36 (2) 7 7 8 (3) 6 6 7 (00) 5 5 6 (01) 4 4 (02) 3 3 (030) 2 3 (031) 1 (dummy) 0 (dummy) 0 2. Ternary Huffman word lengths Which of the following sequences of word lengths cannot be the word lengths of a 3-ary Huffman code and which can ? (a) L = (1 , 1 , 2 , 2 , 3 , 3 , 3) (b) L = (1 , 1 , 2 , 2 , 3 , 3) (c) L = (1 , 1 , 2 , 2 , 3) (d) L = (1 , 2 , 2 , 2 , 2 , 2 , 2) (e) L = (1 , 2 , 2 , 2 , 2) Solution: Ternary Huffman word lengths The simplest way is to draw a ternary tree for each case. Once we have 1
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
the tree, we can easily determine whether the set of codes derived from that tree can be Huffman codes (no redundancy) or not. Based on this approach, we can easily see that only codes in (a), (b), and (d) are valid ternary Huffman codes. Alternatively, since the Huffman code tree should be complete including the dummies at the deepest level of the tree, we can obtain a simple condition for Huffman codewords as
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern