Papers
Topics
Authors
Recent
Search
2000 character limit reached

Range-to-Prefix Conversion Algorithm

Updated 7 July 2026
  • Range-to-prefix conversion algorithms transform range queries into a bounded set of prefix queries, enabling efficient data structure mapping and query execution.
  • They underpin key methodologies in succinct string indexing and integer range filtering by leveraging ordered binary representations and dyadic intervals.
  • These reductions offer bidirectional query support, preserving order-theoretic properties and reducing query times through translatable prefix operations.

Searching arXiv for the cited papers to ground the article in current records. Range-to-prefix conversion denotes a family of reductions in which a range query is recast as a bounded number of prefix queries on a derived representation. In current arXiv usage, the term has two principal technical realizations. In succinct string indexing, lexicographic-range queries on the suffix array of a text TT are reduced to prefix-select queries on a sequence WW of short binary strings, yielding an equivalence between suffix-array functionality and prefix-query structures up to an additive O(loglogn)O(\log\log n) query-time term (Kempa et al., 22 Oct 2025). In approximate range filtering, an integer interval [,r][\ell,r] is converted into a minimum-cardinality family of dyadic intervals, each represented by a binary prefix, so that range lookups become a small number of prefix probes (Mößner et al., 2022). A closely related dual construction converts colored-prefix queries into colored-range queries in the external-memory model, showing that prefix/range conversion is a bidirectional design pattern rather than a single domain-specific routine (Larsen et al., 2011).

1. Formal query models

In the suffix-array setting, the source problem is the lexicographic-range query. Given a text T[0..σ)nT \in [0..\sigma)^n, one builds a data structure on TT of size S(n)S(n), and on input two patterns P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^* returns

LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},

where

RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.

Equivalently, one may ask for reporting all positions whose suffixes lie in the half-open interval WW0 in lexicographic order, or just its minimum. The target problem is prefix-select on a sequence WW1 of WW2 binary strings of length exactly WW3; given a query bit-pattern WW4 and a rank WW5, the query returns

WW6

the WW7-th smallest WW8 such that WW9 is a prefix of O(loglogn)O(\log\log n)0 (Kempa et al., 22 Oct 2025).

A second formulation arises in integer range filtering. There the universe is

O(loglogn)O(\log\log n)1

and the task is to cover a query interval O(loglogn)O(\log\log n)2 exactly by a small collection of dyadic intervals. Each dyadic interval corresponds to a binary prefix of length O(loglogn)O(\log\log n)3 for some O(loglogn)O(\log\log n)4, so the range query is transformed into a prefix set. The required cover is exact, and the number of prefixes is minimized by the standard greedy decomposition (Mößner et al., 2022).

These formulations differ in object type—suffix-array intervals versus integer intervals—but they share a common abstraction: a range is replaced by prefix descriptors whose order-theoretic structure is easier to index or hash.

2. Embedded sequence construction and occurrence mapping

The core construction underlying the string-theoretic reduction starts from a sequence O(loglogn)O(\log\log n)5 of bit-strings of length O(loglogn)O(\log\log n)6. Let O(loglogn)O(\log\log n)7. For O(loglogn)O(\log\log n)8, define

O(loglogn)O(\log\log n)9

where `%%%%3TT3%%%%1\mathrm{bin}(x,k)[,r][\ell,r]2k[,r][\ell,r]3x[,r][\ell,r]4[,r][\ell,r]5[,r][\ell,r]6[,r][\ell,r]7[,r][\ell,r]8W[,r][\ell,r]9T(<ahref="/papers/2510.19815"title=""rel="nofollow"dataturbo="false"class="assistantlink"xdataxtooltip.raw="">Kempaetal.,22Oct2025</a>).</p><p>Foraqueryprefix (<a href="/papers/2510.19815" title="" rel="nofollow" data-turbo="false" class="assistant-link" x-data x-tooltip.raw="">Kempa et al., 22 Oct 2025</a>).</p> <p>For a query prefix T \in [0..\sigma)^n$0 with $T \in [0..\sigma)^n$1, let $T \in [0..\sigma)^n$2, and let $T \in [0..\sigma)^n$3 denote the $T \in [0..\sigma)^n$4-th index of $T \in [0..\sigma)^n$5 carrying $T \in [0..\sigma)^n$6 as a prefix. The key observation is

$T \in [0..\sigma)^n$7

These occurrences appear in the same order in $T \in [0..\sigma)^n$8 as the increasing indices $T \in [0..\sigma)^n$9. If

$T$0

then for any $T$1,

$T$2

This occurrence mapping is the structural bridge between suffix-array intervals and prefix-select answers.

The same construction also supports the converse viewpoint. The summary states that any lex-range query on $T$3 can be answered by one $T$4 call plus repeated prefix-select queries on $T$5, while any prefix-select can be implemented by two $T$6 calls and one small-range access on $T$7. The reduction is therefore bidirectional rather than merely one-way.

3. Answering lexicographic ranges through prefix-select

The operational form of the range-to-prefix reduction assumes that one can answer $T$8 in $T$9 time. A lex-range query proceeds by computing

$S(n)$0

If $S(n)$1, the output is empty. In the simple case emphasized in the description, the patterns share a short $S(n)$2-prefix, handled by taking a common prefix $S(n)$3 up to $S(n)$4 or truncated patterns, with the remaining cases handled by a nonperiodic/periodic split. Let

$S(n)$5

Instead of enumerating suffix-array entries directly, one performs $S(n)$6 prefix-select queries of the form $S(n)$7,i)$ and returns the corresponding outputs (Kempa et al., 22 Oct 2025).

The reported complexity is that this answers all S(n)S(n)8 elements of the lex-range in

S(n)S(n)9

More broadly, any data structure using P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^*0 bits, query time P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^*1, build time P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^*2, and working space P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^*3 for suffix-array or lex-range queries on a text of length P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^*4 can be transformed in P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^*5 time into a structure that answers prefix-select queries on P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^*6 short strings in

P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^*7

time and

P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^*8

space, and vice versa.

This equivalence is stronger than a single reduction. It states that suffix-array queries are, up to an additive P1,P2[0..σ)P_1,P_2 \in [0..\sigma)^*9 term in query time, equivalent to prefix-select queries in all parameters. The framework also proves analogous equivalences for inverse suffix-array queries, pattern ranking, lexicographic range, and LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},0-interval queries, thereby identifying six core problem pairs connecting string and prefix-query models.

4. Dyadic decomposition as range-to-prefix conversion

In bloomRF, the range-to-prefix conversion is the standard greedy-from-the-left algorithm for covering an interval LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},1 by the minimum number of dyadic intervals. Starting with LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},2, each iteration computes

LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},3

and sets

LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},4

The chosen dyadic block has size LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},5, its corresponding prefix length is LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},6 bits, and the prefix value is the top LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},7 bits of LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},8, namely LexRangeT(P1,P2){SAT[i]:i(RangeBegT(P1)RangeBegT(P2)]},\mathrm{LexRange}_T(P_1,P_2) \coloneqq \{\, SA_T[i] : i \in (\mathrm{RangeBeg}_T(P_1)\ldots \mathrm{RangeBeg}_T(P_2)] \,\},9. The algorithm appends this prefix and advances RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.0 by the interval size (Mößner et al., 2022).

The decomposition size satisfies two bounds. The loop executes at most

RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.1

steps in the worst case. If the interval length is at most RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.2, then

RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.3

The cover is exact, and the algorithm produces the minimum number of dyadic intervals covering RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.4.

In bloomRF these prefixes are consumed by piecewise-monotone hash-functions. A dyadic interval of size RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.5 corresponds exactly to one word in the bit-array. If a prefix has length RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.6, then it lives at level RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.7, which is mapped to layer RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.8. Because of the final term

RangeBegT(P)={j:T[jn]P}.\mathrm{RangeBeg}_T(P)=|\{\, j : T[j\ldots n]\prec P \,\}|.9

the least significant WW00 bits of the prefix are mapped in order, so that any contiguous set of up to WW01 items inside a dyadic block sits in adjacent bits in a single word. This is the piecewise-monotone property.

The resulting range-to-prefix conversion runs in WW02, and a range query performs one word lookup per prefix. The formal analysis further shows that, because the structure probes at most two words per layer, a range lookup takes WW03 time, independent of WW04.

5. External-memory dual: prefix-to-range conversion

A closely related dual reduction appears in external-memory colored reporting. The colored range reporting problem is defined on sets

WW05

with total size WW06, and asks for

WW07

on input WW08. The colored prefix reporting problem is defined on a static collection

WW09

of strings, each of length WW10, with a function

WW11

and on input pattern WW12 asks for

WW13

The reduction sorts WW14 lexicographically, assigns each string its rank, and sets

WW15

All strings having prefix WW16 occupy a contiguous lexicographic interval WW17, so colored-prefix reporting becomes colored-range reporting on that interval (Larsen et al., 2011).

The interval computation is performed by a compacted trie, or Patricia trie, storing rank-range pointers at internal nodes. The theorem cited from Belazzougui et al. gives a linear-space structure that, for any pattern WW18 of length WW19, returns WW20 in WW21 I/Os. The colored-range side is answered by a linear-space structure with query cost

WW22

I/Os, where WW23 is the output size. Combining the two stages yields colored prefix reporting in

WW24

I/Os and WW25 words of space when WW26.

The model assumptions are explicit: the standard Aggarwal–Vitter I/O model with block size WW27 words and unlimited disk, strings of length WW28 so that each occupies WW29 blocks, no indivisibility assumption, and static data with no insertions or deletions.

6. Relation to suffix-array functionality and prior reductions

The range-to-prefix viewpoint reorganizes several previously separate reductions into a single prefix-query perspective. The FM-index reduction from suffix-array access to rank on the Burrows–Wheeler Transform is identified as the special case WW30 of prefix-select, namely WW31 equal to the single BWT symbol and WW32WW33\Psi$-function also reduces to prefix operations on the BWT array. Recent sublinear-build structures, described as using a variant of prefix-rank/select on synchronizing sets, fit the same template once the range-to-prefix conversion is made explicit (Kempa et al., 22 Oct 2025).

The principal misconception is to treat range-to-prefix conversion as a single algorithmic trick tied to one data structure. The literature instead exhibits a family of reductions with different ambient models: succinct suffix-array functionality on arbitrary-alphabet texts, approximate range filters on integer universes, and external-memory colored reporting. What remains invariant is the reduction principle: encode a range by prefix descriptors that preserve the order needed by the target structure.

A plausible implication is that prefix queries serve as a canonical intermediate representation for several string and range-reporting tasks. The 2025 equivalence result makes that interpretation explicit by showing that essentially all efficient suffix-array representations can be expressed via prefix-select structures, while the 2011 external-memory result and the 2022 bloomRF construction show that analogous prefix encodings also govern optimal I/O-efficient reporting and compact approximate range filters.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Range-to-Prefix Conversion Algorithm.