visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: Pascal :: huffman coding in a pascal program


By: VB guy Canada  Date: 26/04/2003 00:00:00  English  Points: 80 Status: Answered
Quality : Excellent
hi!
i have a homework about huffman coding but written in a program of pascal
an it works like this:
1-take a file contains the text to be coded.
2-count the repetition of each character(a table contains the repetition of each character,we ignore the characters with no repetition)
3-count the frequency of each character(repetition/the number of all characters)
4-sort the characters according to their frequency from low to up.
5-create a node for each character.
6- collect the nodes according to frequency fro low to up :every two nodes have the same frequency form cheldrin to a new node in the tree(the new node has a frequency equal to the sum of its both children)
7-if the number of nodes is odd then we add the last odd node to any of the nodes in the higher level(directly before ).
8-repeat the steps 5-6 until we get one node with a frequency equal to(1)
which form the root of the tree.
9-we define the movement on the tree like this: moving to left means (0) and moving to the right means(1) (0:bit,1:bit).
10-we store the path (track) of each character in the tree (this track is the coding representation for the character in the message),here we use a hashing table : the index is the character and the value is a string contains the notation of the character according to its track in the tree.
11-we sent the message after replacing each character with its notation(the sent file should have two parts:
header[]:where we store the tree, body:wher we save the message)
12-the message should be read backward (after building the tree from hte information that exist in the( header) part,we look for hte characters in the(body) part )

By: VGR Date: 26/04/2003 17:19:00 English  Type : Comment
should be google-isable :D

classical
By: VB guy Date: 27/04/2003 20:26:00 English  Type : Comment
hi VGR !
i realy didn't exactly understand your comment:
should be google-isable:D

By: VGR Date: 27/04/2003 20:41:00 English  Type : Comment
<A HREF="http://www.google.com">www.google.com</a>
type "+huffman +pascal" ;-)
By: VGR Date: 27/04/2003 20:43:00 English  Type : Comment
for example this :D

<A HREF="http://www.experts-exchange.com/Programming/Programming_Languages/Pascal/Q_10112863.html">http://www.experts-exchange.com/Programming/Programming_Languages/Pascal/Q_10112863.html</a>

12/30/1998 06:57PM PST :D :D

the (long) code from SWAG seems perfect, as usual
By: VB guy Date: 27/04/2003 21:06:00 English  Type : Comment
thanks VGR but all the programs i've found were unfortunately not in english.
i've tried the code i've found on the experts/yhheng page but the program didn't execute.
By: VGR Date: 27/04/2003 21:31:00 English  Type : Answer
excuse-me, but "the code is not in Engluish" is a bit weird given all programming languages I know (except Logo) are in English :D

The *** comments *** and perhaps ***variable names*** are not in English, may-be, but does this prevent you from understanding how the program works ?

I even myself suceeded in "recognizing" programs in Russian and Romania, while I speak not a single word of those tongues.

The link given above seems to contain all the code you need. Moreover it's COMPELTELY in English

it even says :

* LZHUF.C English version 1.0
* Based on Japanese version 29-NOV-1988
* LZSS coded by Haruhiko OKUMURA
* Adaptive Huffman Coding coded by Haruyasu YOSHIZAKI
* Edited and translated to English by Kenji RIKITAKE
* Translated from C to Turbo Pascal by Douglas Webb 2/18/91
By: VB guy Date: 27/04/2003 22:15:00 English  Type : Comment
thanks VGR but iam not that stupid ,i know that The *** comments *** and perhaps ***variable names*** are not in English ,but now i've found a pascal program on huffman it seems good although it is making errors and didn't execute yet.
anyway thanks you have been SO PATIENT thanks
By: VB guy Date: 27/04/2003 22:19:00 English  Type : Comment
by the way i've tried the code used in the link which starts with:
* LZHUF.C English version 1.0
* Based on Japanese version 29-NOV-1988
* LZSS coded by Haruhiko OKUMURA
* Adaptive Huffman Coding coded by Haruyasu YOSHIZAKI
* Edited and translated to English by Kenji RIKITAKE
* Translated from C to Turbo Pascal by Douglas Webb
but it didn't work.now iam working on the other program i've found and i think it is going to work

Do register to be able to answer

EContact
browser fav
page generated in 918.181900 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page