I am implementing the LZW algorithm. I have successfully implemented it for strings and text files and am currently modifying my code to work with binary files such as images or executables (since I cannot read these files as strings).
I replaced the type Stringin my code with the type ArrayList<Byte>. My code now compresses and decompresses binaries correctly, however it is at least 10 times slower! This is not acceptable in a compression application where speed is a critical element.
I made the right replacement ArrayList<Byte>for String. Is there a faster alternative with similar functionality? Please note that the LZW algorithm requires resizing the array, so the standard ones are arrays[]not suitable.
Sincerely.
source
share