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 .

Short Answer

Expert verified

(a). It is proved that, Huffman codeword has length 1 if some of the frequencies are greater than 25.

(b). It is proved that, Huffman codeword does not have a codeword of length 1 if all the frequencies are less than13 .

Step by step solution

01

Sum of frequencies

Sum of all the frequencies of a Huffman tree must be 1.Sum of frequencies in the left subtree and right subtree is 1.

02

Proof by contradiction method

(a)

A contradiction for the case is considered here. Let the full binary bree does not have codeword of length 1. Therefore, the root of the tree will not have frequencies as its children. Left child of the root be I and right child of the root be r . Assume children of l are a and b , children of r are c and d, where a,b,c,dare the frequencies.

Sum of frequencies is 1.

l+r=1

It is given that at least one character has frequency greater than 25. Let value of is greater than 25. Then value of r is:

localid="1657263872844" l+r=1r=1-lr<1-25r<35

Hence, r should be less than 35. If r is less than then 35one of the children of r should be maximum 310. If that is the case then that child of r will be less than and should be in the left subtree which is a clear violation of the case discussed. Hence, Huffman codeword has length 1 if some of the frequencies are greater than 25.

03

Proof by contradiction method

(b)

A contradiction for the case is considered here. Let the full binary bree has a codeword of length 1 . So, the root of the tree has a child of frequency less than13 . Let the left subtree be l and right subtree be r . Let value of r is less than13 .

Sum of the frequencies is 1 .

l+r=1l=1-rl>1-13l>23

Thus, l should be greater than 23. If l is greater than23 then one of the children of l should be greater than13 . But all frequencies should be less than 13which clearly violates the contradiction. Hence, Huffman codeword does not have a codeword of length 1 if all the frequencies are less than13 .

Thus, the two statements are proved.

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 Vaia!

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 the following graph.

(a) What is the cost of its minimum spanning tree?

(b) How many minimum spanning trees does it have?

(c) Suppose Kruskal’s algorithm is run on this graph. In what order are the edges added to the MST? For each edge in this sequence, give a cut that justifies its addition.

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?

A binary counter of unspecified length supports two operations: increment (which increases its value by one) and reset (which sets its value back to zero). Show that, starting from an initially zero counter, any sequence of n increment and reset operations takes time O(n); that is, the amortized time per operation is O(1) .

Ternary A server has customers waiting to be served. The service time required by eachcustomer is known in advance: it is ciminutes for customer i. So if, for example, the customers are served in order of increasing i , then the ithcustomer has to wait Pij=1tjminutes. We wish to minimize the total waiting time.

T=Xni=1(time spent waiting by customer ).

Give an efficient algorithm for computing the optimal order in which to process the customers.

Consider an undirected graph G=(V,E)with nonnegative edge weights role="math" localid="1658915178951" we0. 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" sV. 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.

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.

Sign-up for free