Question
Given an alphabet with n characters. Let the characters be numbered from 1 to n, and let the frequency of character ii be fi=12ifi=12i for
Given an alphabet with n characters. Let the characters be numbered from 1 to n, and let the frequency of character ii be fi=12ifi=12i for i=1,2,...,n?1i=1,2,...,n?1, with the last character nn having frequency fn=12n?1fn=12n?1. For example, if n=6, then the frequencies of the first five characters are 1/2, 1/4, 1/8, 1/16, 1/32, respectively, and the frequency of the last character is 1/32. Answer the following questions: a) (5 points) Show that the frequencies of all characters sum to 1 (as they should) for any nn. b) (5 points) Show what the huffman encoding is for each character. In building the encoding tree, the larger frequency child should be on the left, and if there are two groups of characters with the same frequency, the one with the smaller index should be on the left. c) (5 points) What is the expected number of bits per character? Let the encoding length of character ii be denoted as lili, then the expected or average number of bits for the encoding is computed as ?ni=1li?fi?i=1nli?fi. Use this formula to derive an closed form expression (for any n).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started