A Fast and Space - Economical Algorithm for Length - Limited Coding

The minimum-redundancy prefix code problem is to determine a list of integer codeword lengths l=[li¦ie{1... n}], given a list of n symbol weights p=[pi¦ie{1...n}], such that \(\sum\nolimits_{i = 1}^n {2^{ - l_i } } \leqslant 1\), and \(\sum\nolimits_{i = 1}^n {l_i p_i }\)lipi is minimised. An extension is the minimum-redundancy length-limited prefix code problem, in which the further constraint li≤L is imposed, for all i e {1... n} and some integer L≥[log2n]. The package-merge algorithm of Larmore and Hirschberg generates length-limited codes in O(nL) time using O(n) words of auxiliary space. Here we show how the size of the work space can be reduced to O(L2). This represents a useful improvement, since for practical purposes L is Θ(log n).