Huffman trees from segments