English

Fast and Compact Prefix Codes

Data Structures and Algorithms 2009-05-20 v1

Abstract

It is well-known that, given a probability distribution over nn characters, in the worst case it takes (\Theta (n \log n)) bits to store a prefix code with minimum expected codeword length. However, in this paper we first show that, for any 0<ϵ<1/20<\epsilon<1/2 with (1 / \epsilon = \Oh{\polylog{n}}), it takes \Ohnloglog(1/ϵ)\Oh{n \log \log (1 / \epsilon)} bits to store a prefix code with expected codeword length within ϵ\epsilon of the minimum. We then show that, for any constant (c > 1), it takes \Ohn1/clogn\Oh{n^{1 / c} \log n} bits to store a prefix code with expected codeword length at most cc times the minimum. In both cases, our data structures allow us to encode and decode any character in \Oh1\Oh{1} time.

Keywords

Cite

@article{arxiv.0905.3107,
  title  = {Fast and Compact Prefix Codes},
  author = {Travis Gagie and Gonzalo Navarro and Yakov Nekrich},
  journal= {arXiv preprint arXiv:0905.3107},
  year   = {2009}
}
R2 v1 2026-06-21T13:03:51.120Z