Length-limited coding

An O( nL)-time algorithm is given for finding an optimal prefix-free binary code for a weighted alphabet of size n, with the restriction that no code string be longer than L. An 0 (nLlogn)-time algorithm is given for the corresponding alphabetic problem, which is equivalent to optimizing a dictionary of n words, implemented as a binary tree of height h I: L with all data in the leaves.