huffman_leaves(): get huffman code of leaves recursively