What are the space and time complexities, in Big O notation, for the Lempel-Ziv-Welch and Huffman compression algorithms? Google is failing me.
Thanks,
Francisco
Huffman coding is well-situated than LZW coding. LZW coding facilitates more compression ratio than Huffman algorithm. Huffman coding requires more execution time than the LZW. In some cases time is not important as Huffman coding can be used to obtain high compression ratio.
Lempel–Ziv–Welch (LZW) is a universal lossless data compression algorithm created by Abraham Lempel, Jacob Ziv, and Terry Welch. It was published by Welch in 1984 as an improved implementation of the LZ78 algorithm published by Lempel and Ziv in 1978.
LZW TIFFs are considered a lossless file format. LZW TIFF compressions reorder the digital data into a smaller file size without deleting any pixels at all.
LZW compression works by reading a sequence of symbols, grouping the symbols into strings, and converting the strings into codes. Because the codes take up less space than the strings they replace, we get compression.
As the dictionary size is fixed and independent of the input length, LZW is in O(n) as each byte is only read once and the complexity of the operation for each character is constant.
And Huffman encoding is also in O(n): First you count the number of occurrences for each input byte, then you sort it and build the output encoding.
Depends on the implementation. They get better all the time. "Huffman" is a bit too common a term. For example, you could mean an explicit tree, an implicit, a dynamic one... But in any case, I guess if you do it very clever you should be able to implement alomost any "Huffman" on O(n), with n being the text-length.
LZW is also implementation-dependent. I do not know off-hand what "O" common implementations have. I guess with big tables you probably have something like O(n log n), but thats just a guess.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With