/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Q15E We use Huffman's algorithm to ob... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

We use Huffman's algorithm to obtain an encoding of alphabet {a,b,c}with frequencies fa,fb,fc. In each of the following cases, either give an example of frequencies (fa,fb,fc)that would yield the specified code, or explain why the code cannot possibly be obtained (no matter what the frequencies are).

(a) Code:{0,10,11}

(b) Code:{0,1,00}

(c) Code:{10,01,00}

Short Answer

Expert verified
  1. The code0,10,11 can be obtained for frequencies20,30 and 50.
  2. Code 0,1,00cannot be obtained from any of the frequencies, because the tree obtained is not a full binary tree
  3. Code 10,01,00cannot be obtained from any of the frequencies, because the tree obtained is not a full binary tree.

Step by step solution

01

Huffman Encoding

Huffman encoding is done by following a path from the root to leaf of a full binary tree. Every left node of the tree is represented as 0 and every right node of the tree is represented as 1.

(a)

02

Determine the full binary tree of {0,10,11}

Let fa=50, fb=20, fc=30. Prefix free encoding of these frequencies is:

The tree obtained is a full binary tree. Therefore, the frequencies (50,20,30)yield the codelocalid="1657259801818" 0,10,11.

(b)

03

Determine the full binary tree of{0,1,00} 

Prefix free encoding for the given code word is:

The tree obtained is not a full binary tree. Also, it violates an important property:

A codeword cannot be prefix of another codeword. Here, codeword of a(0) is the prefix of codeword ofc(00) Therefore, the no frequencies can yield the code 0,1,00.

(c)

04

Determine the full binary tree of {10,01,00}

Prefix free encoding for the given codeword is:

The tree obtained is not a full binary tree. Thus, no frequencies can yield such a code.

Hence, the codeword0,10,11 can only be yielded from the alphabets.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with 91Ó°ÊÓ!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Consider an undirected graph G=(V,E)with nonnegative edge weights role="math" localid="1658915178951" we≥0. Suppose that you have computed a minimum spanning tree of G, and that you have also computed shortest paths to all nodes from a particular node role="math" localid="1658915296891" s∈V. Now suppose each edge weight is increased by 1: the new weights are w0e=we+1.

(a) Does the minimum spanning tree change? Give an example where it changes or prove it cannot change.

(b) Do the shortest paths change? Give an example where they change or prove they cannot change.

A long string consists of the four characters A,C,G,T ; they appear with frequency 31%,20%,9%and40% respectively. What is the Huffman encoding of these four characters?

Prove the following two properties of the Huffman encoding scheme.

(a) If some character occurs with frequency more than 25, then there is guaranteed to be a codeword of length 1 .

(b) If all characters occur with frequency less than13 , then there is guaranteed to be no codeword of length 1 .

The following statements may or may not be correct, In each case, either prove it (if it is correct) or give a counter-example (if it isn’t correct). Always assume that the graph G=(V,E)is undirected. Do not assume that edge weights are distinct unless this is specifically stated.

  1. If a graph G has more than |V|-1edges, and there is a unique heaviest edge, then this edge cannot be part of a minimum spanning tree.
  2. If G has a cycle with a unique heaviest edge e, then e cannot be part of any MST.
  3. Let e be any edge of minimum weight in G. Then e must be part of some MST.
  4. If the lightest edge in a graph is unique, then it must be part of every MST.
  5. If e is part of some MST of G, then it must be a lightest edge across some cut of .
  6. If G has a cycle with a unique lightest edge e must be part of every MST.
  7. The shortest-path tree computed by Dijkstra’s algorithm is necessarily an MST.
  8. The shortest path between two nodes is necessarily part of some MST.
  9. Prim’s algorithm works correctly when there are negative edges.
  10. (For any r>0, define an r-path to be a path whose edges all have weight <r). If G contains an r-path from node s to t , then every MST of G must also contain an r-path from node s to node t.

The following table gives the frequencies of the letters of the English language (including the blank for separating words) in a particular corpus.

blank

18.3%

r

4.8%

y

1.6%

e

10.2%

d

3.5%

p

1.6%

t

7.7%

l

3.4%

b

1.3%

a

6.8%

c

2.6%

v

0.9%

o

5.9%

u

2.4%

k

0.6%

i

5.8%

m

2.1%

j

0.2%

n

5.5%

w

1.9%

x

0.2%

s

5.1%

f

1.8%

q

0.1%

h

4.9%

g

1.7%

z

0.1%

  1. What is the optimum Huffman encoding of this alphabet?
  2. What is the expected number of bits per letter?
  3. Suppose now that we calculate the entropy of these frequencies

H=∑t=026ptlog1pt

(see the box in page 143). Would you expect it to be larger or smaller than your answer above? Explain.

d. Do you think that this is the limit of how much English text can be compressed? What features of the English language, besides letters and their frequencies, should a better compression scheme take into account?

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.