Social Icons

twitterfacebookgoogle plusemail

jueves, 25 de abril de 2013

T4: Adaptive coding

The goal of this homework is to invent, implement and evaluate an adaptative code that compress ASCII text. The requirements is that we're not allow to based on an existent algorithm. As you may know, we use an income letter and that letter must be coded and saved to make a kind of dictionary to make a compression.

 The principal idea it's just save the letter as it comes and keep it in a dictionary of generated symbol and the frequency gave it, and of course I have a rule to make it adaptative but first I need to explain how it works.

Sequence    Letter            Symbol    Frequency  Current Output

-----------------------------------------------------------------------------------------------------------------------

        1                         A       ->    [a:0]         [a:1]               [a:0]

-----------------------------------------------------------------------------------------------------------------------
        2                         A       ->    [a:0]         [a:2]               [a:0]0
-----------------------------------------------------------------------------------------------------------------------
        3                         B       ->    [b:1]         [b:1]            [a:0]0[b:1]
-----------------------------------------------------------------------------------------------------------------------
        4                         C       ->    [c:01]       [c:1]            [a:0]0[b:1][c:01]
-----------------------------------------------------------------------------------------------------------------------
        5                         A       ->    [a:0]         [a:3]          [a:0]0[b:1][c:01]0

-----------------------------------------------------------------------------------------------------------------------
        6                         C       ->    [c:01]       [c:2]         [a:0]0[b:1][c:01]0,01

-----------------------------------------------------------------------------------------------------------------------


As you can see this is a way to compress ASCII text just using a dictionary and putting his own values in the compression, but here comes a question "Where is the adaptative?", well the adaptative form comes with this rule, when I have a letter with a certain percentage of the total of frequencies, then I switched the letter with minimum large of symbol and the minium frequency. Let's explain it.

Sequence    Letter            Symbol    Frequency  Current Output

-----------------------------------------------------------------------------------------------------------------------

        7                         C       ->    [c:01]         [c:3]      [a:0]0[b:1][c:01]0,01,01

-----------------------------------------------------------------------------------------------------------------------
        8                         C       ->    [c:01]         [c:4]   [a:0]0[b:1][c:01]0,01,01,01
-----------------------------------------------------------------------------------------------------------------------
        9                         C       ->    [c:01]         [c:5]  [a:0]0[b:1][c:01]0,01,01,01,01
-----------------------------------------------------------------------------------------------------------------------
      10                       C       ->    [c:1]            [c:6]    [a:0]0[b:1][c:01]0,01,01,01,01[c:1]
-----------------------------------------------------------------------------------------------------------------------
      11                       B       ->    [b:01]         [b:2]   [a:0]0[b:1][c:01]0,01,01,01,01[c:1]b[:2]
-----------------------------------------------------------------------------------------------------------------------

I didn't the code but I complete my design, that's all.

1 comentarios:

  1. La explicación no es la más clara posible, pero la idea está bien. 0+3.

    ResponderEliminar