title: Difficulty understanding decompression with LZW algorithm
body: <p>I compressed the following message: &quot;ababcbababaaaaaaa&quot; using LZW compression algorithm.</p>
  <p>With a=1;b=2;c=3 i get the following message : &quot;1 2 4 3 5 8 1 10 11 1&quot;, which matches the result my professor got in our exercise notes.</p>
  <p>However, when i try decompressing the message, i get the following sequence of events:</p>
  <pre><code>Current: a  ; Next: b  ; Output: a  ; AddToDict: ab=4;
  
  Current: b  ; Next: a  ; Output: b  ; AddToDict: ba=5;
  
  Current: ab ; Next: c  ; Output: ab ; AddToDict: abc=6;
  
  Current: c  ; Next: ba ; Output: c  ; AddToDict: cb=7;
  
  Current: ba ; Next: 8? ; Output: ?  ; AddToDict: ?;
  </code></pre>
  <p>As you can see, my issue is that i dont have 8(which is supposed to be &quot;bab&quot;) in the dictionary yet.</p>
  <p>What am i doing wrong?</p>
  <p>The complete dictionary gained from compression is</p>
  <p>(1=a;2=b;3=c;4=ab;5=ba;6=abc;7=cb;8=bab;9=baba;10=aa;11=aaa;12=aaaa)</p>