Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,
I dont want zipfile I want to compress 1000 bytes of data to 100 bytes how can we do this plz help me
Posted

It is actually quite simple: throw away all the zero bits. Since they don't represent anything, you can discard them without any problems.

In addition, stop posting the same question with different numbers, and then deleting it when it is answered!
 
Share this answer
 
Is is a joke? Use simple logic. Still not getting it?

OK, nobody can help you.
Yes, in a special case you can pack 1000 in approximately 100 bytes, depending on algorithm, a little better or much worse, but this is when all the data consists of equal bytes! It all depends on input data. Even it you want to compress by 10%, nobody can guarantee you this result for arbitrary data.

I don't have a heart to try to explain it. If it was not obvious to you in first place…
Did you used zip before? Ever interested to know why lost-less compression is even possible? I was simply shocked by this question. Tell me, again, was that a joke?

—SA
 
Share this answer
 
v4
Comments
Sergey Alexandrovich Kryukov 5-Mar-11 19:23pm    
OP Commented:

Hi,
Thank You for ur reply and This is not a joke. How can i Use Algorithm to do this,I mean which algorithm and what is the procedure to do this.
Sergey Alexandrovich Kryukov 5-Mar-11 19:26pm    
If this is not a joke, you don't really have a chance. Did you understand my Answer? In practice, it means: there is no way.
Sorry,
--SA
Target compression size can not be deterministic or can not be fixed.
To me Hoffman compression algorithm works pretty well for me.

To implement the algorithm this link might be useful:
http://www.daniweb.com/code/snippet216267.html[^]

The target compression size depends on the Algorithm and the Input pattern.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 5-Mar-11 19:31pm    
A point about deterministic size of good of course, but I already answered in other words.
Hoffman compression does work, but... did you do estimate? (I did.) 1000 to 100 -- in practice, no chance! Please see my Answer and comments or try it out and report you results, if you're curious.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900