Using Huffman Compression

Discussion in 'C Programming' started by dirgesh@gmail.com, Oct 12, 2005.

  1. Guest

    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.
     
    , Oct 12, 2005
    #1
    1. Advertising

  2. Ben Pfaff Guest

    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
     
    Ben Pfaff, Oct 12, 2005
    #2
    1. Advertising

  3. Michael Mair Guest

    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.
     
    Michael Mair, Oct 12, 2005
    #3
  4. Skarmander Guest

    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/search.pl?query=huffman 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.
     
    Skarmander, Oct 12, 2005
    #4
  5. osmium Guest

    <> 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
     
    osmium, Oct 12, 2005
    #5
  6. In article <> writes:
    > 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/
     
    Dik T. Winter, Oct 13, 2005
    #6
  7. Mabden Guest

    "Ben Pfaff" <> wrote in message
    news:...
    > 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
     
    Mabden, Oct 27, 2005
    #7
  8. Ben Pfaff Guest

    "Mabden" <mabden@sbc_global.net> writes:

    > "Ben Pfaff" <> wrote in message
    > news:...
    >> 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
     
    Ben Pfaff, Oct 27, 2005
    #8
  9. Mabden Guest

    "Ben Pfaff" <> wrote in message
    news:...
    > "Mabden" <mabden@sbc_global.net> writes:
    >
    > > "Ben Pfaff" <> wrote in message
    > > news:...
    > >> 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
     
    Mabden, Oct 28, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. NOBODY
    Replies:
    2
    Views:
    817
    Thomas Weidenfeller
    Oct 17, 2003
  2. niko
    Replies:
    3
    Views:
    3,799
  3. dot

    Python Huffman encoding

    dot, Nov 25, 2004, in forum: Python
    Replies:
    3
    Views:
    1,795
    Guyon Morée
    Nov 30, 2004
  4. lukabratzi

    Help with Huffman Compression

    lukabratzi, Jul 18, 2010, in forum: C Programming
    Replies:
    0
    Views:
    359
    lukabratzi
    Jul 18, 2010
  5. Josef 'Jupp' SCHUGT

    Compression (besides Huffman) and Ruby

    Josef 'Jupp' SCHUGT, Jan 7, 2004, in forum: Ruby
    Replies:
    10
    Views:
    266
    Joel VanderWerf
    Jan 8, 2004
Loading...

Share This Page