For many kinds of prefix-free codes there are efficient and compact alternatives to the traditional tree-based representation. Since these put the codes into canonical form, however, they can only be used when we can choose the order in which codewords are assigned to symbols. In this paper we first show how, given a probability distribution over an alphabet of $\sigma$ symbols, we can store an optimal alphabetic prefix-free code in $\Oh{\sigma \log L}$ bits such that we can encode and decode any codeword of length $\ell$ in $\Oh{\min (\ell, \log L)}$ time, where $L$ is the maximum codeword length. With $\Oh{2^{L^\epsilon}}$ further bits, for any constant $\epsilon>0$, we can encode and decode $\Oh{\log \ell}$ time. We then show how to store a nearly optimal alphabetic prefix-free code in \(o (\sigma)\) bits such that we can encode and decode in constant time. We also consider a kind of optimal prefix-free code introduced recently where the codewords' lengths are non-decreasing if arranged in lexicographic order of their reverses. We reduce their storage space to $\Oh{\sigma \log L}$ while maintaining encoding and decoding times in $\Oh{\ell}$. We also show how, with $\Oh{2^{\epsilon L}}$ further bits, we can encode and decode in constant time. All of our results hold in the word-RAM model.
翻译:对于许多种类的无前缀代码来说,对于传统树基代表值来说,有高效和紧凑的替代值。由于这些将代码以金字形形式输入,但是,由于这些代码只能在我们能够选择代码用于符号的顺序时才能使用。在本文中,我们首先展示了如何,考虑到在$\gISl$符号的字母上的概率分布,我们可以在$\oh=sigma\log L}中存储一个最优的字母前缀代码,这样我们就可以在$=O$$(ell, log L)}时间中编码并解码任何长度为$(ell)$(美元)的编码。当$L$(美元)是最大代码长度时,它们只能使用。如果$\2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\xl=$(美元)的代码在任何恒定值中,我们可以在$的编码中编码和的代码中保存一个最优字母规则。我们也可以的代码,我们也可以的代码也可以保留。