Abstract
In this paper we present a new algorithm for adaptive prefix coding. Our algorithm encodes a text S of m symbols in O(m) time, i.e., in O(1) amortized time per symbol. The length of the encoded string is bounded above by (H+1)m+O(nlog 2 m) bits where n is the alphabet size and H is the entropy.
This is the first algorithm that adaptively encodes a text in O(m) time and achieves an almost optimal bound on the encoding length in the worst case. Besides that, our algorithm does not depend on an explicit code tree traversal.
Similar content being viewed by others
References
Andersson, A., Miltersen, P.B., Thorup, M.: Fusion trees can be implemented with AC0 instructions only. Theor. Comput. Sci. 215, 337–344 (1999)
Connell, J.B.: A Huffman-Shannon-Fano code. Proc. IEEE 61, 1046–1047 (1973)
Capocelli, R.M., De Santis, A.: New bounds on the redundancy of Huffman codes. IEEE Trans. Inf. Theory 37, 1095–1104 (1991)
Faller, N.: An adaptive system for data compression. In: Proc. 7th Asilomar Conference on Circuits, Systems, and Computers, pp. 593–597 (1973)
Fredman, M.L., Willard, D.E.: Surpassing the information theoretic bound with fusion trees. J. Comput. Syst. Sci. 47, 424–436 (1993)
Gagie, T.: Dynamic Shannon coding. In: Proc. the 12th European Symposium on Algorithms. LNCS, vol. 3221, pp. 359–370. Springer, Berlin (2004), see also Inf. Process. Lett. 102, 113–117 (2007)
Gallager, R.G.: Variations on a theme by Huffman. IEEE Trans. Inf. Theory 24, 668–674 (1978)
Golumbic, M.C.: Combinatorial merging. IEEE Trans. Comput. 25, 1164–1167 (1976)
Huffman, D.A.: A method for construction of minimum-redundancy codes. Proc. IRE 40, 1098–1101 (1952)
Klein, S.T.: Skeleton trees for the efficient decoding of Huffman encoded texts. Inf. Retr. 3, 7–23 (2000). A preliminary version, Space- and time-efficient decoding with canonical Huffman trees, appeared in Proc. the 8th Annual Symposium on Combinatorial Pattern Matching. LNCS, vol. 1264, pp. 65–75 (1997).
Knuth, D.E.: Dynamic Huffman coding. J. Algorithms 6, 163–180 (1985)
Lelewer, D.A., Hirschberg, D.S.: Data compression. ACM Comput. Surv. 19, 261–296 (1987)
Milidiú, R.L., Laber, E.S., Pessoa, A.A.: Bounding the compression loss of the FGK algorithm. J. Algorithms 32, 195–211 (1999)
Moffat, A., Turpin, A.: On the implementation of minimum-redundancy prefix codes. IEEE Trans. Commun. 45, 1200–1207 (1997)
Rueda, L., Oommen, B.J.: A fast and efficient nearly-optimal adaptive Fano coding scheme. Inf. Sci. 176, 1656–1683 (2006)
Shannon, C.E.: A mathematical theory of communication. Bell Syst. Techn. J. 27, 379–423 (1948)
Shannon, C.E.: A mathematical theory of communication. Bell Syst. Techn. J. 27, 623–656 (1948)
Schwartz, E.S., Kallick, B.: Generating a canonical prefix encoding. Commun. ACM 7, 166–169 (1964)
Turpin, A., Moffat, A.: On-line adaptive canonical prefix coding with bounded compression loss. IEEE Trans. Inf. Theory 47, 88–98 (2001)
Vitter, J.S.: Design and analysis of dynamic Huffman codes. J. ACM 34, 825–845 (1987)
Author information
Authors and Affiliations
Corresponding author
Additional information
A preliminary version of this paper appeared in the Proceedings of the 2006 IEEE International Symposium on Information Theory (ISIT 2006).
M. Karpinski’s work partially supported by a DFG grant, Max-Planck Research Prize, and IST grant 14036 (RAND-APX).
Y. Nekrich’s work partially supported by IST grant 14036 (RAND-APX).
Rights and permissions
About this article
Cite this article
Karpinski, M., Nekrich, Y. A Fast Algorithm for Adaptive Prefix Coding. Algorithmica 55, 29–41 (2009). https://doi.org/10.1007/s00453-007-9140-4
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-007-9140-4