A fast and space-economical algorithm for length-limited coding

  • Jyrki Katajainen
  • Alistair Moffat
  • Andrew Turpin
Session 1
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1004)


The minimum-redundancy prefix code problem is to determine a list of integer codeword lengths l=[li¦{1... n}], given a list of n symbol weights p=[pi¦{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 ε {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).


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    T.C. Hu and K.C. Tan. Path length of binary search trees. SIAM Journal of Applied Mathematics, 22(2):225–234, March 1972.Google Scholar
  2. 2.
    D.A. Huffman. A method for the construction of minimum-redundancy codes. Proc. Inst. Radio Engineers, 40(9):1098–1101, September 1952.Google Scholar
  3. 3.
    L.L. Larmore and D.S. Hirschberg. A fast algorithm for optimal length-limited Huffman codes. Journal of the ACM, 37(3):464–473, July 1990.Google Scholar
  4. 4.
    L.L. Larmore and T.M. Przytycka. Constructing Huffman trees in parallel. SIAM Journal on Computing. To appear.Google Scholar
  5. 5.
    A. Moffat and J. Katajainen. In-place calculation of minimum-redundancy codes. In Proc. Workshop on Algorithms and Data Structures, Kingston University, Canada, August 1995. Springer-Verlag. To appear.Google Scholar
  6. 6.
    A. Moffat, A. Turpin, and J. Katajainen. Space-efficient construction of optimal prefix codes. In Proc. IEEE Data Compression Conference, pages 192–201, Snowbird, Utah, March 1995. IEEE Computer Society Press, Los Alamitos, California.Google Scholar
  7. 7.
    B. Schieber. Computing a minimum-weight k-link path in graphs with the concave Monge property. In Proc. 6th Ann. Symp. Discrete Algorithms, pages 405–411, San Francisco, California, January 1995. SIAM, Philadelphia, Pennsylvania.Google Scholar
  8. 8.
    J. van Leeuwen. On the construction of Huffman trees. In Proc. 3rd International Colloquium on Automata, Languages, and Programming, pages 382–410, Edinburgh University, Scotland, July 1976.Google Scholar
  9. 9.
    D.C. Van Voorhis. Constructing codes with bounded codeword lengths. IEEE Transactions on Information Theory, IT-20(2):288–290, March 1974.Google Scholar

Copyright information

© Springer-Verlag 1995

Authors and Affiliations

  • Jyrki Katajainen
    • 1
  • Alistair Moffat
    • 2
  • Andrew Turpin
    • 2
  1. 1.Department of Computer ScienceUniversity of CopenhagenCopenhagen EastDenmark
  2. 2.Department of Computer ScienceThe University of MelbourneParkvilleAustralia

Personalised recommendations