Home -> Playground -> LZW Decoding
algorithm decode(encodings): define working as an empty string. define symbol_table 0 to 256. for each encoding in encodings: is encoding is in symbol_table? define symbols as encoding. else: define symbols as concatenation of working and working[0]. for each symbol in symbols: output symbol. define aug as concatenation of working and symbol. is aug in the symbol_table? assign working as aug. else: add aug to symbol_table with key of code. assign working as symbol. increment code.