This greedy algorithm generates a tree of binary prefix codes by minimizing the sum of weights times length of binary code-words.
A one-pass variant of this procedure acts without initial knowledge of the source distribution and changes the structure of the central tree as probability estimates update as the symbol table is traversed; that modification of this algorithm is used in the Vitter algorithm. The so-called canonical form of this algorithm sorts by length first, then value. Where n is the input size, this algorithm is big-O of n log n, although if the input weights are known, it can be reduced to linear. This algorithm's bottom-up property makes it more efficient than the alternative top-down Shannon-Fano algorithm. This greedy algorithm generates a tree of binary prefix codes by minimizing the sum of weights times length of binary code-words. For 10 points, name this encoding algorithm used in lossless compression because it assigns the shortest codewords to the most frequent elements, making it the most efficient method possible.
A one-pass variant of this procedure acts without initial knowledge of the source distribution and changes the structure of the central tree as probability estimates update as the symbol table is traversed; that modification of this algorithm is used in the Vitter algorithm.
Huffman coding