Skip to main content

In-place calculation of minimum-redundancy codes

  • Invited Presentation
  • Conference paper
  • First Online:
Book cover Algorithms and Data Structures (WADS 1995)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 955))

Included in the following conference series:

Abstract

The optimal prefixfree code problem is to determine, for a given array p=[p i ¦i∈{1...n}] of n weights, an integer array l= [l i ¦∈{1...n}] of n codeword lengths such that \(\sum\nolimits_{i = 1}^n {2^{ - l_i } \leqslant 1}\)and \(\sum\nolimits_{i = 1}^n {p_i l_i }\)is minmized. Huffman's famous greedy algorithm solves this problem in O(n log n) time, if p is unsorted; and can be implemented to execute in O(n) time, if the input array p is sorted. Here we consider the space requirements of the greedy method. We show that if p is sorted then it is possible to calculate the array l in-place, with l i overwriting p i , in O(n) time and using O(1) additional space. The new implementation leads directly to an O(n log n)-time and n + O(1) words of extra space implementation for the case when p is not sorted. The proposed method is simple to implement and executes quickly.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. J.L. Bentley and M.D. McIlroy. Engineering a sorting function. Software—Practice and Experience 23 (1993) 1249–1265.

    Google Scholar 

  2. S. Carlsson, J. Katajainen, and J. Teuhola. In-place linear probing sort. Submitted. Preliminary version appeared in Proceedings of the 9th Symposium on Theoretical Aspects of Computer Science, Lecture Notes in Computer Science 577, Springer-Verlag, Berlin/Heidelberg, Germany (1992) 581–587.

    Google Scholar 

  3. D. Hirschberg and D. Lelewer. Efficient decoding of prefix codes. Communications of the ACM 33 (1990) 449–459.

    Article  Google Scholar 

  4. D.A. Huffman. A method for the construction of minimum-redundancy codes. Proceedings of the Inst. Radio Engineers 40 (1952) 1098–1101.

    Google Scholar 

  5. L.L. Larmore and T.M. Przytycka. Constructing Huffman trees in parallel. SIAM Journal on Computing. To appear.

    Google Scholar 

  6. J. van Leeuwen. On the construction of Huffman trees. In Proceedings of the 3rd International Colloquium on Automata, Languages and Programming, Edinburgh University Press, Edinburgh, Scotland (1976) 382–410.

    Google Scholar 

  7. D.A. Lelewer and D.S. Hirschberg. Data compression. Computing Surveys 19 (1987) 261–296.

    Article  Google Scholar 

  8. A. Moffat, A. Turpin, and J. Katajainen. Space-efficient construction of optimal prefix codes. Proceedings of the 5th IEEE Data Compression Conference, IEEE Computer Society Press, Los Alamitos, California (1995) 192–201.

    Google Scholar 

  9. R. Sedgewick. Algorithms in C. 2nd Edition, Addison-Wesley, Reading, Massachusetts (1990).

    Google Scholar 

  10. I.H. Witten, A. Moffat, and T.C. Bell. Managing Gigabytes: Compressing and Indexing Documents and Images. Van Nostrand Reinhold, New York, New York (1994).

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Selim G. Akl Frank Dehne Jörg-Rüdiger Sack Nicola Santoro

Rights and permissions

Reprints and permissions

Copyright information

© 1995 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Moffat, A., Katajainen, J. (1995). In-place calculation of minimum-redundancy codes. In: Akl, S.G., Dehne, F., Sack, JR., Santoro, N. (eds) Algorithms and Data Structures. WADS 1995. Lecture Notes in Computer Science, vol 955. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-60220-8_79

Download citation

  • DOI: https://doi.org/10.1007/3-540-60220-8_79

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-60220-0

  • Online ISBN: 978-3-540-44747-4

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics