title: How to find the Compression ratio of a file using Huffman coding
body: <p>I have compressed a <code>binary file</code> using <code>Huffman encoding</code>. Now i am trying to find the <code>compression efficiency</code>.</p>
  
  <p>In my Binary file i have symbols(bunch of 0 &amp; 1) and frequency(repetition of symbols).
  suppose i have :</p>
  
  <pre><code>symbol :0 freq : 173
  symbol :1 freq : 50
  symbol :2 freq : 48
  symbol :3 freq : 45 
  </code></pre>
  
  <p>size of file would be (173+50+48+45)*8=<code>2528</code> (If my way of calculating the size is correct? please correct me if i am wrong. (On debugging i get 2536) (8 more i don't know why ?)</p>
  
  <p>After compression i got <code>encoding</code> like this</p>
  
  <pre><code>symbol : 0 Code : 1
  symbol : 1 Code : 00
  symbol : 2 Code : 011
  symbol : 3 Code : 010
  </code></pre>
  
  <p>Could some one please tell me how to get <strong>Huffman compression efficiency</strong> of this binary file using these information ? (I tried searching on google but there is no sample of binary file they have some frequency of float type which i am not able to understand how to relate them with my Binary file). Thanks a lot for this . Algorithm (c/c++/c#) to do that is also appreciated.</p>