Adding Huffman Coding with complexity O(nlogn)