uppose a file contains the letters a, b, c and d. Nominally we require 2 bits per letter to store such a file. Assume the letter a occurs 50% of the time, b occurs 30% of the time, c and d each occurs 10% of the time. Give an encoding of each letter as a bit string that provides optimal compression as follows.
Letter Encoding
a 1
b 01
c 001
d 000
The percentage of compression the above scheme can be calculated as follows.
1 × 0.5 + 2 × 0.3 + 3 × 0.1 + 3 × 0.1 = 1.7 So the compressed data uses 1.7/2 × 100 = 85% as many bits, or a 15% compression gain. This is the average of the compression percentages achieved for each letter, weighted by the letter’s frequency. Repeat this, assuming and each a and b occurs 40% of the time, c occurs 15% of the time, and d occurs 5% of the time. What is the compression gain?

Respuesta :

The compression gain is 10%.

How to calculate conpression gain?

We know that

a = 40% b = 40% c = 15% and d = 5%

With the help of the given data

a = 1 ,b = 01, c = 001 , d = 000 we can draw a huffman tree.

Thus 0.4 x 1 + 0.4 x 2 + 0.15 x 3 + 0.05 x 3 = 1.8

Compression gain = 100 - 1.8/2 X 100 = 10%

Everywhere data compression is applied. Compressed data is used by several distinct file types. A 3-minute song would be over 100Mb in size and a 10-minute video would be over 1Gb without data compression. Large files are reduced in size through data compression. By eliminating superfluous data while keeping the information in the file, it does this.

A reduction in the number of bits needed to represent data can be referred to as data compression. Data compression can reduce hardware storage and network capacity expenses, speed up file transfers, and conserve storage space.

To know more about compression gain refer:

https://brainly.com/question/28530921

#SPJ4

ACCESS MORE