Re: Compression idea
- Posted by Lewis Townsend <keroltarr at HOTMAIL.COM> Jan 23, 2001
- 482 views
Hello Grape_, >The problem is just how to decide what is a sting of data that belongs in >the dictionary. I started writing a compression library based on a "similar" idea at one time. However, when I got it finished, it didn't provide very good compression. Don't be discouraged by my lack of success since your idea is significantly different that my word "similar" above is a debatable. The similarity however was that it DID search for repeated strings so that they could be replaced by something shorter. I don't have the file available at this computer but I think the search code was something like this: sequence source -- is the source string constant slen = length( source ) integer len -- length of current segment sequence s -- current segment for len = 2 to floor( slen/2 ) do -- slen/2 is maximum seg length for pos = 1 to slen-len do -- try every segment in the source s = source[pos..pos+len] -- extract segment if match( s, source[pos+len..slen] ) -- is there any more of it? --this is a repeated string end if end for end for I hope this is somehow helpful as it is completely un-tested. later, Lewis Townsend _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com