jueves, 11 de abril de 2013

Assignment 3. Text compression


For this assignment is necesary implement the tree-based Huffman coding for Unicode strings. 

This algorithm consists in the creation of a binary tree in which each of  the leaves contain a character string to compress with the frequency whit which it is repeated in the character string. 

Based on the assignment of codes to different bit length of each character composing a text string. If short codes are assigned to the characters that appear more often, you get a greater understanding of the text string.

Process
  I give the input character string, in this case use the next line of text for example:

Laptop nueva

1. Characters ordered from lowest to highest according to the number of times they are repeated.



2. We create a new tree root that contain the character with their respective number of frequency in the chain and insert the tree in a tree list.


3. Each of the characters as a tree is created and added to a list, each tree has its associated symbol and frequency number.

 
 4. From the above it will select the first two trees from the list and will form a new tree with them:

5. The root of the new tree will be the sum of the frequencies of the roots of two trees to be joined and tree are now child nodes 


6. It adds to the list the new tree created by ordering from lowest to highest

  
7.  It gets to select two trees from the list and will form a new tree with them, before the tree realiar delete the two trees of the list, until a single tree in the list. 



Not operate properly but here is some code that would make these processes. 




Continued...

Link
Huffman

1 comentario:

  1. 3+2. Necesitarías estar aquí para elegir un ejercicio por puntos extra. Vas mal.

    ResponderEliminar