Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Using Huffman Compression

Reply
Thread Tools

Using Huffman Compression

 
 
dirgesh@gmail.com
Guest
Posts: n/a
 
      10-12-2005
I am having a hard time making a Program in C/C++ that uses the Huffman
Compression to compress a file.

I have a file "Hello World" That i need to compress.

can someone please give me an example of how to do it with huffman
compression.

 
Reply With Quote
 
 
 
 
Ben Pfaff
Guest
Posts: n/a
 
      10-12-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) writes:

> I am having a hard time making a Program in C/C++ that uses the Huffman
> Compression to compress a file.
>
> I have a file "Hello World" That i need to compress.


I don't think you're going to be able to usefully compress "Hello
World". At most, you could reduce it by a few bytes.
--
"I should killfile you where you stand, worthless human." --Kaz
 
Reply With Quote
 
 
 
 
Michael Mair
Guest
Posts: n/a
 
      10-12-2005
(E-Mail Removed) wrote:
> I am having a hard time making a Program in C/C++ that uses the Huffman
> Compression to compress a file.
>
> I have a file "Hello World" That i need to compress.
>
> can someone please give me an example of how to do it with huffman
> compression.


Sure. If you have not understood the algorithm -> comp.programming
If you have understood the algorithm: Show us your best shot at
it and describe your problems clearly and concisely.

If you expect to get your homework done by others: Ask somewhere else.

Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
 
Reply With Quote
 
Skarmander
Guest
Posts: n/a
 
      10-12-2005
(E-Mail Removed) wrote:
> I am having a hard time making a Program in C/C++ that uses the Huffman
> Compression to compress a file.
>
> I have a file "Hello World" That i need to compress.
>
> can someone please give me an example of how to do it with huffman
> compression.
>

http://just****inggoogleit.com/searc...ffman+coding+c

The task of filling up the blanks I'd rather leave to you. Feel free to
ask if you get stuck trying to implement the algorithm, but you'll
otherwise have to do your own homework.

S.
 
Reply With Quote
 
osmium
Guest
Posts: n/a
 
      10-12-2005
<(E-Mail Removed)> wrote:

>I am having a hard time making a Program in C/C++ that uses the Huffman
> Compression to compress a file.
>
> I have a file "Hello World" That i need to compress.
>
> can someone please give me an example of how to do it with huffman
> compression.


Try taking a look at this.

http://en.wikipedia.org/wiki/Huffman_coding


 
Reply With Quote
 
Dik T. Winter
Guest
Posts: n/a
 
      10-12-2005
In article <(E-Mail Removed)> (E-Mail Removed) writes:
> (E-Mail Removed) writes:
>
> > I am having a hard time making a Program in C/C++ that uses the Huffman
> > Compression to compress a file.
> >
> > I have a file "Hello World" That i need to compress.

>
> I don't think you're going to be able to usefully compress "Hello
> World". At most, you could reduce it by a few bytes.


Without quotes Huffman reduces it from 88 bits to 32 bits (11 bytes to
4 bytes). With quotes from 104 bits to 40 buts (13 bytes to 5 bytes).
However, this excludes the table used...
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
 
Reply With Quote
 
Mabden
Guest
Posts: n/a
 
      10-27-2005
"Ben Pfaff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> (E-Mail Removed) writes:
>
> > I am having a hard time making a Program in C/C++ that uses the

Huffman
> > Compression to compress a file.
> >
> > I have a file "Hello World" That i need to compress.

>
> I don't think you're going to be able to usefully compress "Hello
> World". At most, you could reduce it by a few bytes.


Easy. Here's some pseudo code:

If string = "Hello World" then x=1
write X
end

--
Mabden


 
Reply With Quote
 
Ben Pfaff
Guest
Posts: n/a
 
      10-27-2005
"Mabden" <mabden@sbc_global.net> writes:

> "Ben Pfaff" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> (E-Mail Removed) writes:
>>
>> > I am having a hard time making a Program in C/C++ that uses the

> Huffman
>> > Compression to compress a file.
>> >
>> > I have a file "Hello World" That i need to compress.

>>
>> I don't think you're going to be able to usefully compress "Hello
>> World". At most, you could reduce it by a few bytes.

>
> Easy. Here's some pseudo code:
>
> If string = "Hello World" then x=1
> write X
> end


Wow. You reduced it by...a few bytes.
--
"You call this a *C* question? What the hell are you smoking?" --Kaz
 
Reply With Quote
 
Mabden
Guest
Posts: n/a
 
      10-28-2005
"Ben Pfaff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Mabden" <mabden@sbc_global.net> writes:
>
> > "Ben Pfaff" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> (E-Mail Removed) writes:
> >>
> >> > I am having a hard time making a Program in C/C++ that uses the

> > Huffman
> >> > Compression to compress a file.
> >> >
> >> > I have a file "Hello World" That i need to compress.
> >>
> >> I don't think you're going to be able to usefully compress "Hello
> >> World". At most, you could reduce it by a few bytes.

> >
> > Easy. Here's some pseudo code:
> >
> > If string = "Hello World" then x=1
> > write X
> > end

>
> Wow. You reduced it by...a few bytes.


At most. Was there another part of the task that I missed?

I can do the same for the Bible, but I will have to move beyond
booleans...

--
Mabden



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Huffman Compression lukabratzi C++ 0 07-18-2010 03:23 PM
javax.imageio.IIOException: Missing Huffman code niko Java 3 02-12-2005 08:37 PM
Python Huffman encoding dot Python 3 11-30-2004 12:18 PM
Compression (besides Huffman) and Ruby Josef 'Jupp' SCHUGT Ruby 10 01-08-2004 01:23 AM
deflater/inflater and dictionnary for huffman NOBODY Java 2 10-17-2003 08:56 AM



Advertisments