Optimal Prefix Codes with Fewer Distinct Codeword Lengths are Faster to Construct
Abstract
A new method for constructing minimum-redundancy binary prefix codes is described. Our method does not explicitly build a Huffman tree; instead it uses a property of optimal prefix codes to compute the codeword lengths corresponding to the input weights. Let n be the number of weights and k be the number of distinct codeword lengths as produced by the algorithm for the optimum codes. The running time of our algorithm is O(k · n). Following our previous work in be, no algorithm can possibly construct optimal prefix codes in o(k · n) time. When the given weights are presorted our algorithm performs O(9k · 2kn) comparisons.
Turn this paper into a full lesson
ArcXiv compiles a staged curriculum from this paper: 8-12 lessons across beginner → advanced, synthesised section guides, visuals, flashcards, a quiz, exercises, and on-demand deep dives per section. Grounded in the abstract, never invented.