/*! 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} Q16E Prove the following two properti... [FREE SOLUTION] | 91影视

91影视

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

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 Huffman. Trimedia Disks Inc. has developed 鈥渢ernary鈥 hard disks. Each cell on a disk can now store values 0,1, or 2(instead of just 0 or 1). To take advantage of this new technology, provide a modified Huffman algorithm for compressing sequences of characters from an alphabet of size n, where the characters occur with known frequencies f1, f2,...., fn. Your algorithm should encode each character with a variable-length codeword over the values 0,1,2, such that no codeword is a prefix of another codeword and so as to obtain the maximum possible compression. Prove that your algorithm is correct

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.

Question: Suppose the symbols a,b,c,d,e occur with frequencies 12,14,18,116,116,respectively.

(a) What is the Huffman encoding of the alphabet?

(b) If this encoding is applied to a file consisting of1,000,1000 characters with the given frequencies, what is the length of the encoded file in bits?

The basic intuition behind Huffman鈥檚 algorithm, that frequent blocks should have short encodings and infrequent blocks should have long encodings, is also at work in English, where typical words like I, you, is, and, to, from, and so on are short, and rarely used words like velociraptor are longer.

However, words like fire!, help!, and run! are short not because they are frequent, but perhaps because time is precious in situations where they are used.

To make things theoretical, suppose we have a file composed of m different words, with frequencies f1,...,fm. Suppose also that for the ithword, the cost per bit of encoding is ci. Thus, if we find a prefix-free code where the ithword has a codeword of length Ii, then the total cost of the encoding will be localid="1659078764835" ficili.

Show how to modify Huffman鈥檚 algorithm to find the prefix-free encoding of minimum total cost.

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.