Google Answers Logo
View Question
 
Q: huffmann encoding/decoding program ( No Answer,   0 Comments )
Question  
Subject: huffmann encoding/decoding program
Category: Computers > Programming
Asked by: blazer26-ga
List Price: $20.00
Posted: 01 May 2006 12:24 PDT
Expires: 02 May 2006 20:16 PDT
Question ID: 724445
I need a program that will enc/dec a an input file given a huffmann
coding. The program can be in c/c++ and will be required to have its
data from stdin.

Assume that I have an input file called "In" and a generated coding
scheme called "Code"

I should be able to do the follwing with these two SEPERATE modules:

cat In | ./encode Code > Out1

cat Out1 | ./decode Code > Out2

diff In Out2  //should be no different, should be the original file.


Sample Run:

//file that has some words that need to be encoded/decoded
[input]
i like computers
[/input]

//applying a freq. progarm to count chars/freq it will generate
[freq]
10      1
32      2
99      1
101     2
105     2
107     1
108     1
109     1
111     1
112     1
114     1
115     1
116     1
117     1
[/freq]

//applying the freq file to huffman program you will get the following
[code]
101     000
105     001
10      0100
99      0101
107     0110
108     0111
109     1000
111     1001
112     1010
114     1011
115     1100
116     1101
117     1110
32      1111
[/code]

//so from the code and input, we can encode/decode the files. These
are the TWO MODULES that need to be written
//encode program, if we apply "cat input | ./encode code > Out1"
//get a packed binary 
[Out1]
|§á5£nÑ#
[/Out1]


//then I will call decode with "cat Out1 | ./decode.pl code >
original" and I should get the orignal input file which is
[original]
i like computers
[/original]

//by calling "diff original Out1 , it should return no differences

Both enc/dec must work in the follwing manner allowing redirecting/piping. 

If you have any questions or would like something clarified, please
email me about it, because it needs to be in this specific format
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy