Efficient and Compact Representations of Some Non-canonical Prefix-Free Codes

  • Antonio Fariña
  • Travis Gagie
  • Giovanni Manzini
  • Gonzalo Navarro
  • Alberto Ordóñez
Conference paper

DOI: 10.1007/978-3-319-46049-9_5

Part of the Lecture Notes in Computer Science book series (LNCS, volume 9954)
Cite this paper as:
Fariña A., Gagie T., Manzini G., Navarro G., Ordóñez A. (2016) Efficient and Compact Representations of Some Non-canonical Prefix-Free Codes. In: Inenaga S., Sadakane K., Sakai T. (eds) String Processing and Information Retrieval. SPIRE 2016. Lecture Notes in Computer Science, vol 9954. Springer, Cham


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 characters. In this paper we first show how, given a probability distribution over an alphabet of \(\sigma \) characters, we can store a nearly optimal alphabetic prefix-free code in \(o (\sigma )\) bits such that we can encode and decode any character in constant time. We then consider a kind of code introduced recently to reduce the space usage of wavelet matrices (Claude, Navarro, and Ordóñez, Information Systems, 2015). They showed how to build an optimal prefix-free code such that the codewords’ lengths are non-decreasing when they are arranged such that their reverses are in lexicographic order. We show how to store such a code in \(\mathcal {O}\!\left( {\sigma \log L + 2^{\epsilon L}}\right) \) bits, where L is the maximum codeword length and \(\epsilon \) is any positive constant, such that we can encode and decode any character in constant time under reasonable assumptions. Otherwise, we can always encode and decode a codeword of \(\ell \) bits in time \(\mathcal {O}\!\left( {\ell }\right) \) using \(\mathcal {O}\!\left( {\sigma \log L}\right) \) bits of space.

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  • Antonio Fariña
    • 1
  • Travis Gagie
    • 2
  • Giovanni Manzini
    • 3
    • 4
  • Gonzalo Navarro
    • 5
  • Alberto Ordóñez
    • 6
  1. 1.Database LaboratoryUniversity of A CoruñaA CoruñaSpain
  2. 2.Department of Computer ScienceHelsinki Institute for Information Technology (HIIT), University of HelsinkiHelsinkiFinland
  3. 3.Institute of Computer ScienceUniversity of Eastern PiedmontAlessandriaItaly
  4. 4.IIT-CNRPisaItaly
  5. 5.Department of Computer ScienceUniversity of ChileSantiagoChile
  6. 6.Yoop SLA CoruñaSpain

Personalised recommendations