Overview
LZW starts from a dictionary of single symbols and adds longer phrases as it reads the input. The decoder rebuilds the same dictionary from the emitted codes, so explicit phrase strings do not need to be transmitted.
Compresses streams by replacing repeated phrases with dictionary codes built during encoding.
Compact metadata for implementation and discovery.
LZW starts from a dictionary of single symbols and adds longer phrases as it reads the input. The decoder rebuilds the same dictionary from the emitted codes, so explicit phrase strings do not need to be transmitted.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n)
Average
O(n)
Worst
O(n)
Space
O(k)
dictionary[next_code] = current_phrase + next_symbolAdds the next unseen phrase so later repeats can be emitted as compact codes.
Show phrases being added to a dictionary and reused as codes.
LZW compression depends on synchronized dictionary growth rather than transmitting the dictionary itself.
What each reference supports for this entry.
Compression textbook support for LZW's coding model, decoder behavior, and implementation tradeoffs.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.