Some words like “Help", "Stop", “Fire", “Run" are short, not because they are frequently used, but perhaps because time is precious in the situations

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter3: Understanding Structure
Section: Chapter Questions
Problem 2GZ
icon
Related questions
Question
Some words like “Help", "Stop", “Fire", “Run" are short, not because they
are frequently used, but perhaps because time is precious in the situations
Transcribed Image Text:Some words like “Help", "Stop", “Fire", “Run" are short, not because they are frequently used, but perhaps because time is precious in the situations
in which these words are required. With the same token, in designing a
source code for the random variable X, the average code length can be
weighted using costs assigned for different realizations of X. Specifically,
let X be a random variables that takes values from the alphabet &
{1,2, ... , m} with probabilities p; = Px(i) where i E {1,2, .. , m}. Let l;
be the length of the codeword associated with X = i. Also, let c; be the
cost per symbol of the codeword when X = i. Therefore, the average cost
C of the code description of X can be written as
m
C = EP:cili
i=1
(a) You want to design a prefix code for X with lengths 1, l2,...,lm
(ED-li < 1) such that the average description cost C is mini-
mized. You need to find the minimizing set of lengths {l†,l;,...,}
and the corresponding value of the minimum cost C*.
In class, we studied two different methods to solve this problem:
(1) the Lagrangian approach and (2) the KL distance approach.
Use both methods to verify your answer.
Hint. You may wish to define a new distribution over X, namely
qi = qx(i), where
m
CiPi
and Q=>ciPi
Q
i=1
Note that q is a valid probability distribution.
(b) How would you use the Huffman code procedure to minimize C (over
all possible prefix codes)? Specifically, what distribution you want to
use to design a Huffman code?
Transcribed Image Text:in which these words are required. With the same token, in designing a source code for the random variable X, the average code length can be weighted using costs assigned for different realizations of X. Specifically, let X be a random variables that takes values from the alphabet & {1,2, ... , m} with probabilities p; = Px(i) where i E {1,2, .. , m}. Let l; be the length of the codeword associated with X = i. Also, let c; be the cost per symbol of the codeword when X = i. Therefore, the average cost C of the code description of X can be written as m C = EP:cili i=1 (a) You want to design a prefix code for X with lengths 1, l2,...,lm (ED-li < 1) such that the average description cost C is mini- mized. You need to find the minimizing set of lengths {l†,l;,...,} and the corresponding value of the minimum cost C*. In class, we studied two different methods to solve this problem: (1) the Lagrangian approach and (2) the KL distance approach. Use both methods to verify your answer. Hint. You may wish to define a new distribution over X, namely qi = qx(i), where m CiPi and Q=>ciPi Q i=1 Note that q is a valid probability distribution. (b) How would you use the Huffman code procedure to minimize C (over all possible prefix codes)? Specifically, what distribution you want to use to design a Huffman code?
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT