I have compressed a binary file
using Huffman encoding
. Now i am trying to find the compression efficiency
.
In my Binary file i have symbols(bunch of 0 & 1) and frequency(repetition of symbols). suppose i have :
symbol :0 freq : 173
symbol :1 freq : 50
symbol :2 freq : 48
symbol :3 freq : 45
size of file would be (173+50+48+45)*8=2528
(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 ?)
After compression i got encoding
like this
symbol : 0 Code : 1
symbol : 1 Code : 00
symbol : 2 Code : 011
symbol : 3 Code : 010
Could some one please tell me how to get Huffman compression efficiency 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.