0
    updown

    Data Compression

    Posted over 2 years ago

    files from the internet.You must have noticed that almost always, they are in .rar or .zip format i.e. they are compressed.Compression allows us to reduce the size of a file by up to 75%.

    Now,the question that arises is, HOW IS IT DONE? Let me explain.

    compression:

    1. Lossless Compresssion: In lossless,as the nae suggests,there is no loss i.e. the data is fully recovered on decompression. Eg. winRAR files,WinZip files.

    2. Lossy Compresion: In lossy compression,there is a loss in the data while compression i.e. thecompressed file is never exactly equal to the original file. But, the loss is generally not noticable.Eg. MP3 files, JPEG pictures.

    Lossless work?

    again and again.

    Let us consider an example:

    "Democracy is government of the people,by the people,for te people".

    If we consider a charater to occupy 2 bytes in the memory,then the sentence occupes 138 bytes. You might notice that the words "the" and "people" are reapeated 3 times. So, we create a dictionary by assigning a number to these words. Now we can use the numbers in place of these words. So the sentence becomes:

    "democracy is government of 1 2, by 1 2,for 1 2."

    The dictionary contains:---1: "the" , 2: "people" .

    Now,the sentence along with the dictionary occupies only 124 bytes. But, the compression program doesn't see this sentence as a group of words.It sees this as a collection of characters.So, its doesn't see which words are repeated. Instead,it sees which combination of charascters are repeated. So, it may take " the people" as a single unit. So ,the dictionary may contain "1 : the people".

    Now the sentence becomes :

    "Democracy is government of 1, by 1, for 1".

    the dictionary occupies only 104 bytes.Thus, we have achieved about compressioncompression in an entire article,chapter or even the entire book!.

    compression is much more in the programs written in programming languages like C++,java,visual basic,etc. where some keywords are repeated again and again. This was the simplest compression algorithm. There are many others like HoffMann coding and LZW algorithm.

    compression this sentence:

    "Ask not what your country can do for you,ask what you can do for your country".

    lossless.

    Lossy compession works by removing informatin in such a way that it isn't noticeable. I may write about itnext time.

    compression).

    Atul Barapatre

    0
    updown
    0 comments to the post
    Leave a comment