optimisation of huffman. o(n²) -> o(n log (n) ) i think, need some checking.