Question

In: Computer Science

Suppose the alphabet is S = {A B C D} and the known probability distribution is...

Suppose the alphabet is S = {A B C D} and the known probability distribution is PA = 0.3, PB = 0.1, PC = 0.5, and PD = 0.1. Decode the Huffman coding result {11000010101110100} to the original string based on the probability distribution mentioned above. The codeword for symbol “D” is {111}. Please writing down all the details of calculation.

Solutions

Expert Solution

Given Information

PA = 0.3, PB = 0.1, PC = 0.5, and PD = 0.1

First, let us create a Huffman tree

Since D's codeword is 111, it has to be at the extreme right of the root node.

In Huffman tree

Left child is assigned with value 0

The right child is assigned with value 1

Here is the Huffman tree

While constructing a Huffman tree, we always start from the lowest values of probability or frequency. First B, D are merged based on their probabilities. BD's result is merged with the next smallest probability, that is A. At last we merge with C to get the root node.

From the above Huffman Tree

A = 10

B = 110

C = 0

And it is proved that D = 111

Let us decode 11000010101110100

110 00010101110100

B 0 0 0 10101110100 //We have three zeros//

BCCC 10 10 1110100 // We have two 10//

BCCCAA 111 0100

BCCCAAD 0 100

BCCCAADC 10 0

BCCCAADCA 0

BCCCAADCAC is the original string.

If you liked the solution, please give a positive rating to the answer. Your rating motivates experts to help other students also. Thank you :)


Related Solutions

Make the following: a. frequency distribution b. pareto chart c. probability distribution d. pie graph for...
Make the following: a. frequency distribution b. pareto chart c. probability distribution d. pie graph for the following set of numbers : Prophecy - 15 out of 50 Advice - 7 out of 50 Wisdom - 17 out of 50 Compliments - 4 out of 50 Misc. - 7 out of 50
Consider the following probability distribution of returns estimated for Projects B, C and D. Construct an...
Consider the following probability distribution of returns estimated for Projects B, C and D. Construct an equal-weighted (50/50) portfolio of Investments B and D. State Probability B C D Very poor 0.1 25% -25% 15% Poor 0.2 15% -5% 10% Average 0.4 10% 15% 0% Good 0.2 0% 35% 25% Very good 0.1 -10% 55% 35% The expected rate of return of the portfolio is 10.25. What is the standard deviation?
Find the number of N digit sequences from the alphabet a, b, c, d with an...
Find the number of N digit sequences from the alphabet a, b, c, d with an even number of a's and an odd number of b's
Consider the following probability distribution for stocks C and D: State Probability Return on Stock C...
Consider the following probability distribution for stocks C and D: State Probability Return on Stock C Return on Stock D 1 0.30 7 % – 9 % 2 0.50 11 % 14 % 3 0.20 – 16 % 26 % If you invest 25% of your money in C and 75% in D, what would be your portfolio's expected rate of return and standard deviation? Select one: a. 9.891%; 8.70% b. 9.945%; 11.12% c. 8.225%; 8.70% d. 10.275%; 11.12%
2. Let S be the set of strings over the alphabet Σ = {a, b, c}...
2. Let S be the set of strings over the alphabet Σ = {a, b, c} defined recursively by (1) λ ∈ S and a ∈ S; and (2) if x ∈ S, then bxc ∈ S. Recall that λ denotes the empty string which has no letters and has length 0. List all strings of S which are length at most seven. 3. Prove the following theorem by induction: For every integer n ≥ 1, 1 · 2 +...
Suppose a three element subset of {a,b,c,d,e} is selected at random. What is the probability the...
Suppose a three element subset of {a,b,c,d,e} is selected at random. What is the probability the subset will contain the element c? What is the probability it will contain neither of the elements d and e?
What is the sum of the probabilities of all outcomes in a probability distribution? a. 0 b. 1/2 c. 1 d. It cannot be determined.
What is the sum of the probabilities of all outcomes in a probability distribution?a. 0b. 1/2c. 1d. It cannot be determined.
3. Are the following languages A and B over the alphabet Σ = {a, b, c,...
3. Are the following languages A and B over the alphabet Σ = {a, b, c, d} regular or nonregular? • For a language that is regular, give a regular expression that defines it. • For a nonregular language, using the pumping lemma prove that it is not regular. (a) A = {d 2j+1c k+1 | j ≥ k ≥ 0} · {c r+2b 2s+3 | r ≥ 0 and s ≥ 0} (b) B = {a 2j+2b k+3c j+1...
Consider the cross: A/a; b/b; C/c; D/d; E/e x A/a; B/b; c/c; D/d; e/e a) what...
Consider the cross: A/a; b/b; C/c; D/d; E/e x A/a; B/b; c/c; D/d; e/e a) what proportion of the progeny will phenotypically resemble the first parent? b) what proportion of the progeny will genotypically resemble neither parent?
Consider the following probability distribution for Stock Fund (S) and Bond Fund (B). State Probability Return...
Consider the following probability distribution for Stock Fund (S) and Bond Fund (B). State Probability Return on Bond Fund Return on Stock Fund 1 .2 -10% 20% 2 .4 10% 30% 3 .4 18% -10% The expected return and the standard deviation of the Stock Fund are 12% and 18.33%, respectively. What is the expected return of Bond Fund? 8.2% 8.5% 8.9% 9.2% 9.6% What is the standard deviation of Bond Fund? 8.57% 9.23% 9.45% 10.25% 12.78% What is the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT