{
  "slug": "wavelet-tree",
  "term": "Wavelet tree",
  "aliases": [
    "Wavelet trees"
  ],
  "definition": "A wavelet tree represents a symbol sequence through recursive alphabet partitions and routing bitmaps that support access, rank and select queries.",
  "note": "Structure: In the basic ordered binary form, each internal node splits its symbol range and stores one routing bit per symbol in its subsequence. Stable partitioning preserves relative order within each child; subsequences need not be stored explicitly. [survey]\n\nQueries: Access recovers a symbol, rank counts its occurrences in a prefix, and select locates an occurrence. Balanced trees take O(log sigma) steps for alphabet [0, sigma), assuming constant-time bitmap rank/select. Prefix endpoints and occurrence numbering must be stated. [matrix-2012]\n\nSpace: For n symbols, the basic routing bitmaps use at most n * ceil(log2(sigma)) bits. Rank/select support and tree representation add space. Compressed bitmaps or Huffman shaping change this accounting; a tree alone does not ensure compression. [survey]\n\nOrder: Ordered symbol partitions support range counting and quantiles. Ordinary Huffman shaping need not preserve numeric order, so those operations do not transfer unchanged. This is an exact sequence index, not a signal-processing wavelet transform. [survey] [matrix-2014]",
  "related": [
    "rrr-bitvector",
    "wavelet-matrix",
    "rank-select",
    "huffman-coding"
  ],
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-17",
  "citations": [
    {
      "id": "survey",
      "title": "Gonzalo Navarro: Wavelet Trees for All, Journal of Discrete Algorithms 25 (2014), sections 1-4 and 6.2",
      "url": "https://users.dcc.uchile.cl/~gnavarro/ps/jda13.pdf",
      "accessed": "2026-11-17"
    },
    {
      "id": "matrix-2012",
      "title": "Francisco Claude and Gonzalo Navarro: The Wavelet Matrix, SPIRE 2012, sections 1-2",
      "url": "https://users.dcc.uchile.cl/~gnavarro/ps/spire12.4.pdf",
      "accessed": "2026-11-17"
    },
    {
      "id": "matrix-2014",
      "title": "Claude, Navarro and Ordonez: Efficient Compressed Wavelet Trees over Large Alphabets, arXiv:1405.1220, sections 2 and 6",
      "url": "https://arxiv.org/pdf/1405.1220",
      "accessed": "2026-11-17"
    }
  ],
  "provenance": [
    "Primary-source synthesis of sequence indexing and space bounds, not a benchmark replication or a universal speed comparison."
  ]
}
