473,466 Members | 1,382 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Using Huffman Compression

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.

Nov 15 '05 #1
8 5626
di*****@gmail.com 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.
Nov 15 '05 #2
di*****@gmail.com 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
Nov 15 '05 #3
di*****@gmail.com 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://justfuckinggoogleit.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.
Nov 15 '05 #4
<di*****@gmail.com> 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
Nov 15 '05 #5
In article <87************@benpfaff.org> bl*@cs.stanford.edu writes:
di*****@gmail.com 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/
Nov 15 '05 #6
"Ben Pfaff" <bl*@cs.stanford.edu> wrote in message
news:87************@benpfaff.org...
di*****@gmail.com 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
Nov 15 '05 #7
"Mabden" <mabden@sbc_global.net> writes:
"Ben Pfaff" <bl*@cs.stanford.edu> wrote in message
news:87************@benpfaff.org...
di*****@gmail.com 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
Nov 15 '05 #8
"Ben Pfaff" <bl*@cs.stanford.edu> wrote in message
news:87************@benpfaff.org...
"Mabden" <mabden@sbc_global.net> writes:
"Ben Pfaff" <bl*@cs.stanford.edu> wrote in message
news:87************@benpfaff.org...
di*****@gmail.com 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

Nov 15 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dot | last post by:
Hi all, I have written a Python huffman Encoding Module, for my own amusement. I thought it might be educational/entertaining for other people, so I've put it on my website and wrote about it a...
8
by: Sowen | last post by:
Hi, all I am wondering how to write bits by using ofstream? I have finished a huffman tree, but how can I write the bits to the file in order to gain compression? for example, 'A' returns a...
47
by: Bonj | last post by:
I downloaded the gzlib library from zlib in order to do compression. (http://www.gzip.org/zlib) The prototype of the compression function seems to be int compress (Bytef *dest, uLongf *destLen,...
8
by: james | last post by:
I have ran into a little snag on an old database application I am converting. Out of 63 tables(all seperate files) , two of them are compressed using Huffman Compression. I have been searching all...
15
by: aarklon | last post by:
Hi all, this is the program which I saw in my colleagues book. the program was run on turbo C++ 3.0 compiler /*beginning of header file huff.h*/ #ifndef _HUFF_H_ #define _HUFF_H_
4
by: A_StClaire_ | last post by:
hi all, I'm trying to implement Huffman coding on letters of a string. I've written functions to define the initial leaf nodes (letters and their frequencies) and to sort them. I've also put...
6
by: Steve | last post by:
Hi, I've developed a testing application that stores formatted results in a database. Recently it was requested that I add the ability to generate graphs from the raw, un formatted test results...
3
by: Udhay | last post by:
Sir, I am udhay. I am a student and i am working on Audio compression for my exam. I want to know how does the compression take place in audio?? Can anyone suggest a link for the novice to...
10
by: Speed | last post by:
Hi, Could anyone tell me what is the simplest code to read a 8-bit grayscale JPEG image using C. Thanks a ton, Speed
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.