One area within computers which has always fascinated me is data compression. Recently I decided that I want to know more about it. I googled up for the simplest data compression algorithm that has general use, I found that such algorithm is the LZW algorithm.
Maybe I'm just dumb, but I'm having quite a hard time understanding it! I get the big picture, assigning codes to substrings found within a given file, placing those same codes in a dictionary and ouputing them to the compressed file whenever a found sub-string maches any of the sub-strings previously stored in the dictionary. I think I need to understand it better to make my own implementation, tough.
Can anyone try to explain me the LZW algorithm with more detail and, if it's not asking too much, try to give me some example code?