Ternary Huffman. Trimedia Disks Inc. has developed "ternary" hard disks. Each cell on a disk can now store values $0,1,$ or 2 (instead of just 0 or 1 ). To take advantage of this new technology, provide a modified Huffman algorithm for compressing sequences of characters from an alphabet of size $n$, where the characters occur with known frequencies $f_{1}, f_{2}, \ldots, f_{n} .$ Your algorithm should encode each character with a variable-length codeword over the values 0,1,2 such that no codeword is a prefix of another codeword and so as to obtain the maximum possible compression. Prove that your algorithm is correct.