A depth-first algorithm is presented for the construction of a binary minimum-redundancy variable length code with limited word length. In this algorithm, heuristic information on the mean word length is used for efficient searching. The extension to

-ary codes is also discussed.