Huffman Algorithm In C.

Reply

Join Date: Feb 2008
Posts: 3
Reputation: AMARJEET DUA is an unknown quantity at this point 
Solved Threads: 0
AMARJEET DUA AMARJEET DUA is offline Offline
Newbie Poster

Huffman Algorithm In C.

 
0
  #1
Feb 15th, 2008
I Am Working On A Project Related To Data Compression Using Huffmann Algorithm In C Language..........i Have Generated The Huffmann Codes Using Huffmann Tree.........but The Project Is Yet To Be Completed As I Don`t Know How To Store The Codes In Bits.............i Have Just Learned C.
We Have To Submit The Project By 28 Th Feb............so Expecting A Quick Response...............
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,636
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 718
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Huffman Algorithm In C.

 
0
  #2
Feb 15th, 2008
What do you know about working with bits? Do you know how to set them and shift them?
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Huffman Algorithm In C.

 
0
  #3
Feb 15th, 2008
Usually you will have yourself a little function that takes a specific number of bits (let's say just one bit at a time for each branch in the tree).

The function will modify a static "bits" variable (say, one byte) by shifting in the new bit, and incrementing another static "count" variable that keeps track of the number of bits stored in the byte. Once the counter hits eight (for one byte == eight bits), the byte is written to the output stream, and the "bits" and "count" variables are reset to zero.

You will also need a "final" function that flushes bits remaining when your huffman stream doesn't produce a multiple of eight bits (since the last byte won't be completely filled, but it must still be output).

Hope this helps.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 3
Reputation: AMARJEET DUA is an unknown quantity at this point 
Solved Threads: 0
AMARJEET DUA AMARJEET DUA is offline Offline
Newbie Poster

Thanks.

 
0
  #4
Feb 17th, 2008
Thanks For Your Solution ................i`ll Soon Try To Implement That And Will Report You And Again Ask For Guidance If Required.............well What Is Profession Nwdays And Your Country..............
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,031
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 177
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: Huffman Algorithm In C.

 
0
  #5
Feb 17th, 2008
Glad you found a possible solution.
If you're going to stick around could you do us a favor?
Could you stop Capitalizing at random some ( most ) of the words? It makes your post hard to read.
And we could live without the ..................... as well, it doesn't do anything to enhanced your
writing, but the contrary is true.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 3
Reputation: AMARJEET DUA is an unknown quantity at this point 
Solved Threads: 0
AMARJEET DUA AMARJEET DUA is offline Offline
Newbie Poster

Re: Huffman Algorithm In C.

 
-1
  #6
Feb 19th, 2008
well every person has its own style to communicate..............thats what this is................
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,636
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 718
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Huffman Algorithm In C.

 
0
  #7
Feb 19th, 2008
>well every person has its own style to communicate
>..............thats what this is................
And every person has the right to ignore styles they find difficult to follow. Get used to it.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC