Question:
Data compression algorithm help?
dillxn
2009-08-25 12:13:54 UTC
I'm doing a dossier for my IB Computer Science class my senior year in High School. I chose to do a compression program, because I didn't want to do a boring database management program (haha). I have to write it eventually in JAVA, but I'll be prototyping in a variety of languages, so I just need a jump start on the basic logic of it (meaning I don't need language specific code). I also would like to do this without the assistance of any pre-coded dll's. So yes, I know this will be a very 'down-n-dirty' project to tackle, but it's necessary for the guidelines of the dossier.

I've racked my mind on the subject trying to come up with an equation or algorithm. So far I've decided that I want to work with numbers, not ascii.
So, to accomplish that, I know how to convert the encoded ascii of a file to binary (which would be 8 times as long) and then from binary to decimal (reducing the length to up to 3 times as long as the original data). From decimal I'd like to convert that data to something smaller than the original size of the data.

If anyone has any basic logic of how to do this that would help me out (and I suspect it will most likely rely on some mathematical equation) or any pseudo-code, that would be awesome :D

I greatly appreciate it, guys!
Three answers:
Black Rose
2009-08-25 16:51:19 UTC
There are many algorithms to do data comparison:



The RLE (Run-length encoding)

http://en.wikipedia.org/wiki/Run-length_encoding



The LZW (Lempel–Ziv–Welch)

http://marknelson.us/1989/10/01/lzw-data-compression/

http://en.wikipedia.org/wiki/LZW
Brinstaar
2009-08-25 12:33:48 UTC
Very simple.



Binary is base 2 so converting it to base 10 in decimal simply requires using a right base converter, such as e^x or ln or similar.



The main problem is recognizing the ASCII character that is in the file or input by the user. You'll need to get pre-made machine language code for this.



**What method are you using to recognize the ASCII characters into binary form?
2016-04-07 14:54:47 UTC
no, fast compression doesn't leads the data to loss


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...