Using Huffman Compression

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dirgesh@gmail.com

    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.

  • Michael Mair

    #2
    Re: Using Huffman Compression

    dirgesh@gmail.c om wrote:[color=blue]
    > 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.[/color]

    Sure. If you have not understood the algorithm -> comp.programmin g
    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.

    Comment

    • Ben Pfaff

      #3
      Re: Using Huffman Compression

      dirgesh@gmail.c om writes:
      [color=blue]
      > 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.[/color]

      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

      Comment

      • Skarmander

        #4
        Re: Using Huffman Compression

        dirgesh@gmail.c om wrote:[color=blue]
        > 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.
        >[/color]
        Just Fucking Google It! Search Page -- politely* tell people to Google things first


        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.

        Comment

        • osmium

          #5
          Re: Using Huffman Compression

          <dirgesh@gmail. com> wrote:
          [color=blue]
          >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.[/color]

          Try taking a look at this.




          Comment

          • Dik T. Winter

            #6
            Re: Using Huffman Compression

            In article <87r7aq4spn.fsf @benpfaff.org> blp@cs.stanford .edu writes:[color=blue]
            > dirgesh@gmail.c om writes:
            >[color=green]
            > > 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.[/color]
            >
            > 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.[/color]

            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/

            Comment

            • Mabden

              #7
              Re: Using Huffman Compression

              "Ben Pfaff" <blp@cs.stanfor d.edu> wrote in message
              news:87r7aq4spn .fsf@benpfaff.o rg...[color=blue]
              > dirgesh@gmail.c om writes:
              >[color=green]
              > > I am having a hard time making a Program in C/C++ that uses the[/color][/color]
              Huffman[color=blue][color=green]
              > > Compression to compress a file.
              > >
              > > I have a file "Hello World" That i need to compress.[/color]
              >
              > 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.[/color]

              Easy. Here's some pseudo code:

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

              --
              Mabden


              Comment

              • Ben Pfaff

                #8
                Re: Using Huffman Compression

                "Mabden" <mabden@sbc_glo bal.net> writes:
                [color=blue]
                > "Ben Pfaff" <blp@cs.stanfor d.edu> wrote in message
                > news:87r7aq4spn .fsf@benpfaff.o rg...[color=green]
                >> dirgesh@gmail.c om writes:
                >>[color=darkred]
                >> > I am having a hard time making a Program in C/C++ that uses the[/color][/color]
                > Huffman[color=green][color=darkred]
                >> > Compression to compress a file.
                >> >
                >> > I have a file "Hello World" That i need to compress.[/color]
                >>
                >> 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.[/color]
                >
                > Easy. Here's some pseudo code:
                >
                > If string = "Hello World" then x=1
                > write X
                > end[/color]

                Wow. You reduced it by...a few bytes.
                --
                "You call this a *C* question? What the hell are you smoking?" --Kaz

                Comment

                • Mabden

                  #9
                  Re: Using Huffman Compression

                  "Ben Pfaff" <blp@cs.stanfor d.edu> wrote in message
                  news:87y84fc8do .fsf@benpfaff.o rg...[color=blue]
                  > "Mabden" <mabden@sbc_glo bal.net> writes:
                  >[color=green]
                  > > "Ben Pfaff" <blp@cs.stanfor d.edu> wrote in message
                  > > news:87r7aq4spn .fsf@benpfaff.o rg...[color=darkred]
                  > >> dirgesh@gmail.c om writes:
                  > >>
                  > >> > I am having a hard time making a Program in C/C++ that uses the[/color]
                  > > Huffman[color=darkred]
                  > >> > 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.[/color]
                  > >
                  > > Easy. Here's some pseudo code:
                  > >
                  > > If string = "Hello World" then x=1
                  > > write X
                  > > end[/color]
                  >
                  > Wow. You reduced it by...a few bytes.[/color]

                  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



                  Comment

                  Working...