PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: prune lzw
Date: Thursday, 05 Nov 2020, 17:17:31


    > I am really stuck on the prune function, have spent around 10 hours trying
    > to figure out what went wrong.
    ...
    > I have passed t01 to t12. When I run my code with -p on text, there are
    > always a few characters off. ...

Using commands like

  % head -c 12786 /c/cs323/Doc/linux.words > ! x ; ./encode -p < x | ./decode | cmp x

I discovered that the error occurs when encode reads
the 12786-th character of Doc/linux.words, which is
immediately after the first pruning.

Try dumping to a file the string tables in encode and
decode before and after pruning to ensure that they are
identical.  If so, see why the first code sent after
pruning (= 261) represents different strings to encode
and decode.

--Stan-
PREV INDEX NEXT