title: Confused about prefix free and uniquely decodable with respect to binary code
body: <p><strong>A code</strong> is the assignment of a unique string of characters (a
  codeword) to each character in an alphabet.</p>
  
  <p>A code in which the codewords contain only zeroes and ones is
  called a <strong>binary code.</strong></p>
  
  <p>All ASCII codewords have the same length. This ensures that an
  important property called the <strong>prefix property</strong> holds true for the
  ASCII code.</p>
  
  <p>The encoding of a string of characters from an alphabet (the
  cleartext) is the concatenation of the codewords corresponding to
  the characters of the cleartext, in order, from left to right. A code
  is <strong>uniquely decodable</strong> if the encoding of every possible cleartext
  using that code is unique.</p>
  
  <p>Based on the above information I was trying to do some exercises:</p>
  
  <p>Considering the following matrix:</p>
  
  <pre><code>  Code1   Code2  Code3  Code4
  
  A  0       0        1      1
  
  B  100     1       01     01
  
  C  10      00     001    001
  
  D  11      11    0001    000
  </code></pre>
  
  <p><strong>The confusions:</strong></p>
  
  <ol>
  <li>Are all the above assignment considered as <code>codes</code> since they have a unique string of characters??? </li>
  <li>I understand that <code>code 1 and code 2</code> are prefix free since they do not have equal length. Having said that, if you have a look at <code>code 4</code> for alphabets <code>D and C</code> it cosists of 3 digits. Would <code>code 4</code> be considered prefix free too?</li>
  <li>Is <code>code 3</code> the only uniquely decodable code?</li>
  </ol>