A prefix-free encoding of a finite alphabet Γ assigns each symbol in Γ a binary codeword, such that no codeword is a prefix of another codeword. A prefix-free encoding is minimal if it is not possible to arrive at another prefix-free encoding (of the same symbols) by contracting some of the keywords. For instance, the encoding {0,101} is not minimal since the codeword 101 can be contracted to 1 while still maintaining the prefix-free property.

Show that a minimal prefix-free encoding can be represented by a full binary tree in which each leaf corresponds to a unique element of Γ, whose codeword is generated by the path from the root to that leaf (interpreting a left branch as 0 and a right branch as 1 ).

Short Answer

Expert verified

Every symbol in a binary codeword is assigned a finite alphabet in a prefix free encoding. The encoding {0,10} for example, is not a tiny codeword and has been reduced to 1 while retaining the prefix base characteristic.

Step by step solution

01

Step 1: Prefix-free encoding

• This code is prefix-free encoding, which implies that there are no codewords that are prefixes to other codewords.

• Its prefix-free encode with finite alphabet " Γ" allots as well as every symbolΓ in a binary codeword that represents the entire binary tree and constructs the route from the root to the leaf node.

o There seem to be based on two different nodes: left leaf & right leaf, with the path from the tree's root to the left leaf node indicating " 0 " and the path from the tree's root to the right leaf node indicating " 1 ."

02

Step 2: Proof of minimal prefix-free encoding

Consider the whole binary tree with both the string " s " and a length of " k " for all strings.

• This binary tree has two branches that are labelled "left" and "right."

o Its left branching is labelled " 0 ," while the right branch is labelled " 1 ."

• To achieve the maximum string length, all binary strings are encoded.

o To put it another way, only utilise the total number of levels in all strings.

• Also, encode all of the path's intermediary nodes.

o That is, the path through root node towards intermediate node " a " must be prefix-free, as well as the strings of intermediate node " a " must be encoded as left node with codeword " s0 ."

• Every binary tree currently has to be a full binary tree. Assume that perhaps the intermediate node "b" corresponds to the string " s ." However, the string " s " only has one node, such as " a," which is the value of the codeword " s0."

• The intermediate node " b " is a subtree of the prefix-free string " s " with the codeword " s0."

o To get the superior encoding scheme, change the codeword " s0" with " s " for intermediate node " b."

o As a result, the prefix-free encoding is kept to a minimum.

As a result of this contradiction, the minimum prefix-free encoding is established.

03

Conclusion

Binary tree has to be perhaps the intermediate node “ b ” corresponds to string “ S ”. Base on this we can get result prefix – free encoding is kept to a minimum. As a result, we can get contradiction, the minimum prefix encoding is established.

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

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?

Show how to find the maximum spanning tree of a graph, that is , the spanning tree of largest total weight.

Sometimes we want light spanning trees with certain special properties. Here’s an example.

Input: Undirected graph G=(V,E) ; edge weights we; subset of vertices UV

Output: The lightest spanning tree in which the nodes of U are leaves (there might be other leaves in this tree as well).

(The answer isn’t necessarily a minimum spanning tree.)

Give an algorithm for this problem which runs in O(ElogV) time. (Hint: When you remove nodes Ufrom the optimal solution, what is left?)

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}

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.

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