C++ code implementing huffman map