Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 need help with huffman encoding
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DAV1209




PostPosted: Thu Dec 04, 2003 12:56 pm   Post subject: need help with huffman encoding

i got another assignenment but i don't understand and couldn't firguge how how to write this program

here is the assignment:

Quote:

Huffman Encoding

Huffman encoding is a text compression technique. It uses bit patterns of different lengths to encode characters. Commonly used letters use short bit patterns and less commonly used letters are coded with longer patterns. Other characters simply use their standard ASCII codes. The table below shows an example of how such codes might be organised.

Huffman Code Character
11 A
0110 E
0111 T
1000 C
1011 L
10010 S
10011 R
101000 O
101001 I
101010 N
101011 H

Under this encoding scheme the word CAT would be stored as 1000110111 and BAT would be stored as 01000010110111.

Write a program that will read a text file specified by the user, and encode it using the Huffman code above. The program should also be able to open files that have been encoded as binary strings and translate them back into characters.

Your program should use an interface similar to the one shown.

Huffman Encoding
==============
0 Exit
1 Encode a text file
2 Decode a compressed file

Which operation would you like to perform? 1


What is the name of the input file?
Sample.text
File not found. Please try again"¦
Sample.text
What is the name of the output file?
Sample.huf

Since there will be no screen output you must submit printed versions of 3 files:
"¢ your program listing
"¢ the output file that your program produces when it encodes sample.txt
"¢ the output file that your program produces when it decodes sample2.huf




anyone help me plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...............
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Thu Dec 04, 2003 12:57 pm   Post subject: (No subject)

ARGG!!! at least start!!! dont make us do ur work
Dan




PostPosted: Thu Dec 04, 2003 5:14 pm   Post subject: (No subject)

you will have to use substrings to take letters out of wroads then use if's to check for coman letters

for uncomen letters:

code:

var letter: char := 'X'
var tempLetter:int
var biLetter:string

put letter, " - "..

tempLetter := ord(letter)
put tempLetter, " - "..

biLetter := intstr (tempLetter, 0,2)

put biLetter


then you got to put i all together and output it in a string.

P.S. next time you post you may whont to ask a more spifcket question rather then post your asment or poleop may get mad (inlcuing me)
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
DAV1209




PostPosted: Thu Dec 04, 2003 8:27 pm   Post subject: (No subject)

sorry for that but at my school they didn't help us on the study and my professor just give us the assignment
i was trying to do but i couldn't
he didn't teach us a thing.
really sorry that make you guys angry but we start to learn programming so......
if i can i don't think i'm gonna go up here and ask for help.
but anyway thanks Dan for helping me
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: