A Dynamic Programming Algorithm for Constructing Optimal Refix-Free Codes for Unequal Letter Costs

We consider the problem of constructing prefix-free codes of minimum cost when the encoding alphabet contains letters of unequal length. The complexity of this problem has been unclear for thirty years with the only algorithm known for its solution involving a reduction to integer linear programming. In this paper we introduce a new dynamic programming solution to the problem. It optimally encodes n words in O (n C+2 ) time, if the costs of the letters are integers between 1 and C. While still leaving open the question of whether the general problem is solvable in polynomial time our algorithm seems to be the first one that runs in polynomial time for fixed letter costs.

[1]  Kurt Mehlhorn,et al.  Codes: Unequal Probabilities, Unequal Letter Cost , 1980, JACM.

[2]  Mordecai J. Golin,et al.  Lopsided Trees: Analyses, Algorithms, and Applications , 1996, ICALP.

[3]  Shimon Even,et al.  Efficient Generation of Optimal Prefix Code: Equiprobable Words Using Unequal Cost Letters , 1975, JACM.

[4]  Nils J. Nilsson,et al.  Principles of Artificial Intelligence , 1980, IEEE Transactions on Pattern Analysis and Machine Intelligence.

[5]  Larry E. Stanfel,et al.  Tree Structures for Optimal Searching , 1970, JACM.

[6]  R. Sedgewick,et al.  Algorithms (2nd ed.) , 1988 .

[7]  Paul H. Siegel,et al.  Recording codes for digital magnetic storage , 1985 .

[8]  Mordecai J. Golin,et al.  Prefix Codes: Equiprobable Words, Unequal Letter Costs , 1994, ICALP.

[9]  Michel Latteux,et al.  Variable-Length Maximal Codes , 1996, ICALP.

[10]  Edgar N. Gilbert,et al.  Coding with digits of unequal cost , 1995, IEEE Trans. Inf. Theory.

[11]  Shimon Even,et al.  An algorithm for optimal prefix parsing of a noiseless and memoryless channel , 1973, IEEE Trans. Inf. Theory.

[12]  P. Gács,et al.  Algorithms , 1992 .

[13]  Richard M. Karp,et al.  Minimum-redundancy coding for the discrete noiseless channel , 1961, IRE Trans. Inf. Theory.

[14]  Kurt Mehlhorn,et al.  Data Structures and Algorithms 2: Graph Algorithms and NP-Completeness , 1984, EATCS Monographs on Theoretical Computer Science.

[15]  Kees A. Schouhamer Immink,et al.  Runlength-limited sequences , 1990, Proc. IEEE.

[16]  L. Brillouin,et al.  Science and information theory , 1956 .

[17]  Brian W. Kernighan,et al.  AMPL: A Modeling Language for Mathematical Programming , 1993 .

[18]  Edward M. Reingold,et al.  Optimum lopsided binary trees , 1989, JACM.

[19]  Serap A. Savari Some notes on Varn coding , 1994, IEEE Trans. Inf. Theory.