Manuscript Offprint
arXiv:2611.02969Revisiting (Bijective) Burrows-Wheeler Transform Space-Time Trade-Off Constructions
Abstract
The bijective Burrows–Wheeler transform (BBWT) replaces the delimiter of the ordinary BWT by a Lyndon factorization and sorts factor conjugates in -order. It admits quadratic-time constant-workspace algorithms and linear-time linear-space algorithms.
We extend the small-space BWT trade-off of Crochemore et al. [JDA,'15] to the BBWT and accelerate both constructions. For , let be the maximum construction-batch alphabet size. We construct either transform in time and additional space, assuming . This improves the transferred bound by a factor. If , where is the word size, the time improves to . For inversion, the same bounds hold with the global alphabet size in place of .
1 Introduction
The Burrows–Wheeler transform (BWT) [3] is central to text compression and indexing. Its bijective variant (BBWT), introduced by Gil and Scott (see [2]), needs no delimiter: it sorts the conjugates of the text's Lyndon factors in -order. Construction must therefore respect both factor boundaries and cyclic order. Linear-time, linear-space constructions are known for both transforms [1, 12, 14].
The in-place algorithm of Köppl et al. [9] processes Lyndon factors from left to right, inserting each factor's letters from right to left. We realize this order by reversing each factor in place. Except for the first letter of a factor, each new letter is inserted immediately after the position returned by LF. Naive LF queries give time and workspace.
For the ordinary BWT, Crochemore et al. [4, Thm. 3] give a trade-off: for , construction and inversion take time in the comparison model using additional memory cells, where denotes the maximum number of distinct letters in any length- substring of the input text. da Louza et al. [6] extended this trade-off to simultaneous construction of the BWT and LCP array without changing the asymptotic bounds. We extend the construction trade-off to the BBWT (Thm. 3.2) and improve both constructions (Thm. 8.4). Our construction parameter counts letters in a prepared batch, which need not be contiguous in the original text; Lemma 3.1 relates it to . For inversion we use the global alphabet size .
Other BWT construction algorithms use different space models: Kempa and Kociumaka [8] obtain sublinear time on packed binary strings, while Olbrich [13] construct the BWT from Lyndon grammars of repetitive texts. Neither uses our in-place letter-cell model.
The key observation is that the Lyndon factorization changes only the insertion schedule. Once the schedule is fixed, the BBWT construction uses the same insertions and LF queries as the BWT construction, so both admit the same batch-and-breakpoint structure (BBS) representation [4].
The BBS resembles a bounded piece table [5, 11] of general text editors: the piece table keeps the current transform static and records pending one-letter insertions separately. Unlike a general text editor, it stores at most pending edits, materializes them after each batch, and maintains the letter counts needed for rank and LF.
Useful parameter range. To get sublinear space we need the condition that . Since , the stronger condition suffices in the worst case; it is not necessary for texts with smaller batch alphabets. For , sublinear space in particular requires .
For smaller , even a sorted array of pending breakpoints suffices: if each update takes and scanning a static letter costs , the total time is . Thus, makes the term negligible.
A nonempty string is a Lyndon word if it is strictly lexicographically smaller than all its nontrivial conjugates. Every text has a unique Lyndon factorization such that in lexicographic order and each is a Lyndon word. Duval's algorithm computes this factorization in linear time while outputting the factors from left to right.
The BBWT of is obtained by considering all conjugates of all Lyndon factors , sorting them in -order, and writing the letter that precedes each conjugate inside its factor. For nonempty strings , this order compares the infinite periodic words and lexicographically; equal infinite words may be ordered consistently in either way when the resulting output letters coincide. Equivalently, the BBWT is the extended Burrows–Wheeler transform [10] of the multiset of Lyndon factors.
For a transform string , let be the number of letters in that are smaller than . Throughout the paper, all string positions are one-based. We use the inclusive rank convention , with . We also write for the position of the -th occurrence of in . The LF mapping is . This formula only requires cumulative letter counts and rank queries on the current transform string.
For inversion, we use the forward mapping , where is the conceptual string obtained by sorting the letters in . We do not store the full array . Instead, we access letter by as the unique letter whose cumulative interval contains , i.e., if and only if .
Our algorithms work with a fixed working array of letter cells, each capable of holding one input letter or its rank-compressed code. When the alphabet is already encoded as , these cells can use bits in total; if the original alphabet consists of arbitrary word-sized integer keys, the given array may instead occupy words. For construction, initially contains the input text, i.e., . For inversion, initially contains the ordinary letters of the transform to be inverted; the delimiter position is additionally supplied for the ordinary BWT, while the BBWT needs no delimiter. The input/output cells of
X are not counted as additional space; all space bounds below count only auxiliary storage besides this array.
We work on a RAM with constant-time random access to X and constant-time arithmetic on indices and counters. Letters can be compared in constant time. For the basic bounds, ordered dictionaries are implemented by comparison-based balanced search trees. The acceleration in Sect. 8 additionally uses word-RAM operations.
3 Main Result
The case is exactly the constant-workspace in-place algorithm [9]. We therefore assume throughout this section that is an integer trade-off parameter with .
The BBS of Crochemore et al. [4] stores the current transform statically in a prefix of X and batches at most updates. Each pending insertion is a breakpoint; the structure answers queries on the logical, updated transform without shifting the static part until the batch is flushed.
A construction batch is a consecutive block of insertion steps in the prescribed (B)BWT construction order. Its source letters are the letters consumed by these steps, prepared in insertion order in , where is the length of the static transform at the start of the batch.
The static part of length is sampled into segments of length at most , allowing a segment scan in time. The alphabet of a construction batch consists of its at most source letters and, when the batch begins inside a Lyndon factor, the letter needed for its first LF query. Put ; then . Unlike the substrings defining , a construction batch draws letters from reversed Lyndon factors and need not be contiguous in . However, we can still bound in terms of :
Lemma 3.1. The source letters consumed by one construction batch occupy the union of at most three intervals of , of total length at most . Consequently, . The stronger inequality need not hold.
Proof. If the batch lies within one reversed factor, its source cells form one interval of . Otherwise, it consists of a prefix of its first factor, zero or more complete intermediate factors, and a suffix of its last factor: at most three intervals of total length . For their lengths , monotonicity of gives . The boundary LF letter adds at most one.
Figure 1 illustrates the three source intervals.
Thus, passing from length- substrings to construction batches affects the space bound by at most a constant factor.
Theorem 3.2. Given a text and an integer with , the BBWT of can be constructed in time using additional space, apart from the working array , where . The BBWT can be inverted within the same time and space bounds when replacing with the global alphabet size . In particular, if for construction (respectively, for inversion), the time simplifies to .
Proof idea. Duval's algorithm finds the Lyndon factors from left to right. Before each batch, reverse newly discovered factors and prepare the next at most letters in insertion order, immediately after the static transform in . A factor crossing a batch boundary is resumed using constant-size state. The batch alphabet is therefore known before the rank samples are built. We mark factor starts, where insertion is at position 1; all other insertions follow Eq. (1). In total there are insertions and LF steps.

Figure 1: A construction batch may cross Lyndon factors. Here , where the single box abbreviates six consecutive 's inserted in the preceding batch (also of length six); arrows map the highlighted source letters to their positions in the insertion-order batch, reversing their order within each factor. The optional carry-over letter , inserted in the preceding batch, is charged separately to , accounting for the in .
The BBS (Sect. 5) combines sampled ranks on the static transform with at most pending breakpoints. Its queries agree with those on the materialized transform. A batch of static length takes time and space, including counter initialization. Over batches the total time is time. Duval's scans and factor reversals add total time.
Inversion extracts factors using select queries and a virtual delimiter. Deleted positions and decoded letters are buffered until each flush; the analogous analysis uses instead of .
The insertion rule. Let be the position of the previously inserted letter of the current Lyndon factor. Insert the next letter at
by inserting before the old , then set . The LF step uses the transform before insertion and inclusive rank. The is essential: omitting it transforms into , not .
Example 3.3. Let . Its factors are , ; their reversals give the insertion order. A bullet marks the first letter of a (reversed) factor we process.
| step | consumed letter | new factor | insertion position | after the insertion |
|---|---|---|---|---|
| 1 | • | 1 | ||
| 2 | ||||
| 3 | • | 1 | ||
| 4 | ||||
| 5 |
Indeed, the conjugates in -order are , , , , , whose cyclic predecessors give .
Remark on the intermediate transforms. Intermediate transforms need not equal the BBWT of consumed letters: after step 3, , whereas the extended BWT of is . So our algorithm does not incrementally build a valid BBWT like an online algorithm, but it obeys the following invariant.
Let be the Lyndon factorization and fix . Assume that, before is processed, the current transform is BBWT, with the empty transform for , and let . Insert at position 1 and set . For , evaluate LF on the current transform, set , and insert at position . Throughout this loop, the following invariant holds due to [9, Lemma 2].
is the position of the letter of most recently inserted, and
after the loop the current transform is BBWT.
(I1)
Consequently, after all Lyndon factors have been processed, the current transform is BBWT.
4 Letter-Piece Tables
Construction batches contain only insertions. However, writing updates of directly into is costly since an insertion at position needs to move all letters at positions to the right. Instead, we represent logically: we keep static and bookkeep the insertions in such a way that we can answer queries on the logical transform without materializing it — we materialize after at most insertions. This bookkeeping can be formalized in terms of a letter-piece table (LPT) data structure.
LETTER-PIECE TABLE (LPT) An LPT represents a text implicitly and provides update operations to insert letters at specified positions. The text is initially given explicitly as a static string , which is kept unchanged by the LPT until materialization is invoked. The LPT provides the following operations:
-
: inserts before , i.e., sets and for ,
-
: returns ,
-
: materializes the represented and replaces with
We implement an LPT with a two-level balanced binary search tree (BST) structure. First, a breakpoint is a triple , where is the inserted letter, is its static anchor (before , or after for , and is a handle that specifies its order among breakpoints with that anchor.
An outer BST , keyed by static coordinates, stores the nonempty buckets of breakpoints anchored at , plus a possibly empty sentinel bucket at .
Each bucket is an order-statistic BST whose inorder traversal is the local emission order . The handle identifies a node or adjacent boundary, so insertion at a local boundary takes time.
Materialization emits each gap followed by its bucket: Let be the bucket coordinates and set . Before bucket lies the static gap , possibly empty.
To locate positions in , define a cut , where and is a boundary of . The cut denotes the prefix consisting of , all breakpoints anchored before , and those of preceding . Figure 2 illustrates the representation and a cut.
Materialization. If the breakpoints in global order are , with , then , , , , ..., , , where equal anchors give empty intervening gaps.

Figure 2: A letter-piece table with static letters (blue) and pending breakpoints (orange). The buckets and are anchored before the corresponding static letters; a local boundary determines the logical cut . The prefix , to the left of the dashed cut, contains one static and one inserted .
To write into without overwriting unread letters of , traverse the buckets and gaps right to left. Every static letter originally at moves to an index at least , so its destination has already been vacated. The sweep visits letters and takes time. For inversion, we use a deletion-only variant of the LPT (replacing the operation insert with delete), whose materialization instead scans the static string left to right (Sect. 6).
Access and insertion. Let return the cut after the first letters of . Each outer node stores its contribution , where is the preceding static-gap length, as well as subtree-length sums. Creating a bucket inside a gap splits that gap and updates its successor's length.
Weighted selection in the outer tree finds the relevant gap or bucket in time. Within a gap, arithmetic gives the static coordinate; within a bucket, local selection finds . Both and therefore take time.
To insert , find , create bucket if necessary, insert a breakpoint at , and update the length summaries.
Lemma 4.1. There is an LPT that supports and in time, and that can materialize in time, where . It uses space on top of the static string .
5 The Batch-Breakpoint Structure (BBS)
The BBS augments an LPT with rank and cumulative-count queries. We first describe batch preparation, then the additional summaries.
5.1 Preparing a construction batch
Before building rank samples on the static transform of length , prepare source letters so that contains the next letters in BBWT insertion order.
Run Duval's algorithm when the next factor is needed, and reverse each detected factor in place. If the batch ends within it, retain the next unread coordinate and factor end . A constant-size state records either Duval's next start position or , a factor-start flag, and the boundary LF letter when needed. Thus, a factor is detected and reversed only once.
We record the factor starts in a set of positions . Given we insert a letter from a position in into , put it at position 1; otherwise insert at , as dictated by Eq. (1). The construction-batch alphabet is
The optional extra letter belongs to the last insertion of the previous batch, needed for the first LF step when a factor continues. Thus, ; the preparation state, , and the alphabet dictionary use space.
5.2 Construction breakpoints as a bounded edit buffer
The BBS adds two operations to the LPT:
-
returns the number of occurrences of letter in the prefix .
-
returns the number of occurrences of letters smaller than in .
We call this augmented LPT a batch-breakpoint structure (BBS).
To answer rank queries, we let each local tree store subtree frequencies for all .
For the ordinary BWT, the delimiter is carried as separate state, as in Crochemore et al. [4].
Static rank information on . Partition into segments of length , storing per-letter prefix counts at their boundaries. Finally, to answer , locate in the batch alphabet in time, retrieve its preceding prefix-count sample, and scan the remainder of the containing segment. This all takes time.
Also store for . For sorted , scan once: for each , increment the counter at the smallest with , if any. Prefix sums of these counters give all .
These arrays occupy space and are rebuilt once per batch.
Breakpoint rank. Write when breakpoint precedes cut ; equivalently,
Define the breakpoint prefix count
For a cut , this value decomposes as
Store per-letter subtree counts in the outer tree , with each bucket's total as its node weight. An outer prefix-count query gives the first term in time; a local query on gives the second. These summaries use space. Consequently,
where . Thus rank takes time.
Count queries. The cumulative count used by LF is
Maintain the second term in a letter-keyed BST , storing the multiplicity of each pending letter and subtree multiplicity sums. It has at most keys, so prefix queries and updates take time and space. This avoids an scan per update. Finally,
6 Inversion
Following Köppl et al. [9, Section 5.3], we invert the BBWT by extracting . Temporarily appending the delimiter either at a static coordinate or virtually, by storing only its position as a cut between surviving letters, without occupying a cell of . We decode each factor left to right, while writing factors right to left as space is released by batch flushes.
Proceed as follows: Store the temporary delimiter's position as , with when absent. At a factor start, insert it logically at position 2, as justified by Köppl et al. [9, Lemma 2]. Each FL step identifies the next output letter; output it, remove the old delimiter, and replace that letter by , remove the marker and start the preceding factor.
The marker is either a virtual cut or a static coordinate temporarily replaced by X$ needs no extra delimiter cell.
The inversion algorithm uses a deletion-only LPT: an inverse batch records deleted ordinary-letter coordinates in a BST , rather than insertion breakpoints, and needs no local bucket trees. The temporary delimiter is handled separately by . Hence, is a BST that bookkeeps the deleted text positions.
For , first find the letter from the cumulative counts , then compute . Here is with deletions and the marker .
Augment with subtree sizes and deleted-letter frequencies over the global alphabet . Let contain both deleted coordinates and the coordinate occupied by the marker, if any; a virtual marker contributes no coordinate. The tree supports
in time.
If is the static boundary (in ) after the first logical letters (in ), excluding the marker when counting static coordinates, then for . For select, find , and convert to its logical position using the number of excluded coordinates and the marker position.
Partition into blocks of length . For every , maintain dynamic prefix sums of surviving occurrences per block. Rank and select use these sums and scan at most one block; during a scan, traverse the sorted deleted coordinates without repeated tree searches. Each deletion updates one block count. Both queries take time and the structure uses space.
As in construction, a letter-keyed prefix-sum tree with at most keys counts excluded letters below and supports updates in time.
The updated cumulative counts are , where
Materialization scans , skips the deleted positions bookkept in , and updates the position of the virtual delimiter in the compacted string, in time. By doing so, the logical transform is unchanged, as depicted in Figure 3.
Writing the decoded factors back. Factors are decoded left to right but occupy the output from right to left. Their lengths are initially unknown, so write each factor temporarily

Figure 3: A deletion-only LPT with a virtual delimiter. The excluded static coordinates (gray, crossed out) are omitted, and the delimiter is inserted at the cut . Flushing compacts the surviving letters into and retains the cut, so both representations yield , as required by invariant I3.

Figure 4: In-place output placement for a batch decoding a, b, c (, ). Compacting the surviving transform to frees ; writing leftward from stores cba there. After the factor is finished, reversing its output interval restores abc. Previously completed factors (green) remain untouched.
in reverse order, growing leftward. Let be the next free position to the left of all output written so far. Buffer the at most letters decoded in a batch, together with their factor boundaries; do not overwrite the static transform before the flush.
If the batch decodes letters from a static transform of length , first compact the surviving ordinary transform into . Then write the buffered letters in decoding order to , restoring original letters if necessary. Since at the start of the batch, these are exactly the freed cells. Continue across batches if a factor is unfinished. Once a factor is complete, reverse its entire interval, including letters written in earlier batches; reversals occur only after the relevant flush. Factor boundaries use space per batch and all reversals take time. No unflushed static letter is overwritten. Figure 4 illustrates the reuse of the freed cells.
An inverse batch performs at most destructive FL steps, records deletions in , buffers decoded letters, and maintains . Rank/select costs per step, with auxiliary space.
Inversion invariants. Let be the Lyndon factorization of , and define . At the start of extracting , the remaining BBWT is BBWT(). After inserting the unique delimiter at position 2, let be the number of extracted letters of . The inverse-factor invariant is
When , removing the delimiter leaves BBWT().
For the batch-boundary invariant, let the logical transform be represented by a static string , excluded static coordinates , and the delimiter state , possibly . A flush copies the surviving ordinary entries of in their original order and carries the delimiter's cut when present. The invariant asserts that the logical transform is preserved:
Lemma 6.1. Invariants I2 and I3 hold.
Proof. Invariant I2. The first entry of the BBWT of a nonempty text is the last letter of its last Lyndon factor [9, Lemma 2]. As shown in [9, Section 5.3], inserting T_xT_xVT_xV is unique and smaller than every ordinary letter. The destructive forward step of Crochemore et al. [4, Fig. 3], applied to the extended last factor, outputs its first ordinary letter, removes the old delimiter entry, and replaces the entry of that letter by the delimiter. It thereby changes the last factor fromto, leaving the previous Lyndon factors unchanged. Induction onproves Invariant I2. After the last ordinary letter is extracted, the factor is the singletonP_x$).
Invariant I3. Let . The logical transform is with if present, inserted at the cut represented by . A flush writes as the new static string and preserves this cut, hence the logical transform and all its rank, select, and FL values.
7 Space and time
Construction stores sampled counters per batch letter and breakpoints with per-letter summaries. The arrays , pending frequencies, and add words. Thus, its auxiliary space is ; inversion uses space. Both work in the original array , retaining edits until a flush with an LPT.
With BSTs, building rank samples on a static transform of length takes time: each scanned letter requires one batch-alphabet predecessor query. Each LF, rank-at-cut, access-cut, or insertion costs time; there are at most updates per batch. Inversion has the same batch bound, and materialization costs time. Hence, each batch takes time, where for construction and for inversion. Summing over batches gives time, or time if .
8 B-Tree Acceleration of the Prefix-Sum Searches
On a word RAM with , high-degree B trees with aggregate sums [7] reduce the BBS search time to . We stipulate that letters are ordered integer keys fitting in one word.
We handle three operations: static predecessor search in the batch alphabet, weighted selection in , and prefix counts of pending letters. Selection must account for static gaps of arbitrary lengths between breakpoints; these gaps are stored at leaves, with searchable partial sums at internal nodes.
SMALL SEARCHABLE PARTIAL SUMS (SSPS)
Fix a word-RAM word size and a length . Maintain nonnegative integers whose total fits in one -bit word, i.e., . The initial entries are given explicitly. Support the following operations:
-
, for : return , where .
-
, for : return the smallest with . Entries may be zero, so the smallest qualifying index is required.
-
, for and : set . Every update must preserve the conditions and .
Lemma 8.1 (Small searchable partial sums). Fix a sufficiently small constant and . SSPS can be initialized in time using words, and supports each operation in amortized time.
Proof. We adapt the small-array structure of Pătrașcu and Demaine [15, Section 2.2]. Write .
At initialization and after every updates, we freeze the prefix sums, similarly to what we did with in LPT: we store their current values and leave these copies unchanged until the next rebuild. We partition the indices into runs, that is, maximal contiguous intervals of indices whose successive frozen prefix sums differ by less than . Thus, a new run starts at exactly when .
For each run , store its boundaries and its base . Represent the current prefix sums as for each , where is the offset from the frozen base. Since a run contains at most indices, its frozen prefix sums span . Moreover, each prefix sum changes by at most between rebuilds. Consequently, throughout this period.
Each offset therefore requires bits. We pack all offsets into a constant number of machine words, using fixed-width signed fields separated by guard bits. These are spare bits between adjacent fields that absorb carries during packed arithmetic and permit independent word-parallel comparisons; they are cleared after updates. For sufficiently small , all fields and their guard bits occupy bits. An update adds to the packed offsets at all indices in constant time. A prefix-sum query reads the corresponding base and offset.
Store the run bases in a dynamic fusion node [16]. For search, find the last base , or let if none exists. Consecutive runs are separated by frozen prefix-sum gaps of at least , whereas each prefix sum changes by at most before rebuilding. Hence, the answer lies in run , run , or at the first position of run , ignoring nonexistent runs.
Examine these candidates in order. For a candidate run , skip it if , and return if . Otherwise, , so fits in one packed word. Comparing all offsets of with in parallel identifies the first index with . This remains correct when entries are zero: the prefix sums are nondecreasing, and we return the first qualifying index.
Constructing the runs and inserting their at most bases into the dynamic fusion node takes time and words. Rebuilding every updates gives amortized time per operation.
Accelerating the two-level LPT. Let , let , and let the prepared batch alphabet be , with . For nonconstant , choose for a sufficiently small constant .
We retain the outer anchor tree and the local bucket trees of Sect. 4, implementing both levels as trees of degree . An outer entry consists of the static gap preceding anchor

Figure 5: Search summaries at a B-tree node. The length weights count the entire materialized sequence in child , whereas counts only pending occurrences of c. Insertion into an existing bucket changes one entry per array along each affected path; a child split rebuilds its parent's arrays.
and its bucket ; its weight is the gap length plus the number of breakpoints in that bucket. Each local tree orders the individual breakpoints in its bucket, each of weight one. Static gaps contribute no pending-letter counts. The leaves of both levels keep entries in balanced binary search trees, augmented with subtree weights and per-letter pending counts for .
For each internal node , with children , store the arrays
These arrays use SSPS (Lemma 8.1), padding unused entries with zeros. Weighted selection first searches the outer tree and, when its result is a bucket, the corresponding local tree . Figure 5 illustrates the two arrays at an internal node of either level.
Weighted selection in the outer B tree locates a static gap or a bucket. For a gap , a cut after letters has static coordinate . For a bucket , an order-statistic query locates the boundary after the first breakpoints.
Similarly, combines an outer prefix count with a prefix count in the selected bucket. Inserting c increments the weight and the c-count on each affected search path. Creating a bucket inside a static gap splits that gap in the outer leaf but changes the total represented length by only one.
A separate searchable partial-sums tree stores , the number of buffered breakpoints carrying each letter . Together with the static counts , it supports
We also replace the letter-keyed BST by a high-degree B tree equipped with SSPS, maintaining the multiplicities of buffered letters.
Lemma 8.2 (Accelerated construction BBS). The dynamic part of the BBS supports accessCut, access, bcount_c, and in time. Each breakpoint insertion takes the same amortized time apart from rebalancing and reconstruction of alphabet-wide summaries, whose total cost during a batch of at most insertions is . The structure uses words.
Proof. For constant , both levels have constant size and can be searched and updated directly, e.g., with plain arrays. Otherwise, each B tree has height , and a leaf operation takes time. Each query visits the outer tree and at most one local tree ; by Lemma 8.1, their internal-node summaries take amortized time per level.
Ordinary insertions update one counter per affected node at each level. Creating an anchor redistributes the static gap inside one outer leaf in time; above that leaf, the total weight still increases by one unless a node splits. Thus queries and ordinary insertions take .
The B tree has at most entries, so its operations satisfy the same time bound.
Rebalancing a leaf uses rotations per insertion, each recomputing counters. A B-tree split rebuilds its parent's arrays of length , costing ; the total weight and counts of the parent are unchanged by the split, so higher ancestors need no rebuilding. Across both tree levels, insertions cause splits and leaf rotations. Their total reconstruction cost is therefore . There are outer entries and inner breakpoints, with summary information per stored entry, giving words in total.
Since the batch alphabet is fixed, we build a fusion tree on its sorted letters to support predecessor and equality queries. This dictionary is used to index the static rank samples and cumulative counts of . A fusion tree [16] over the sorted batch alphabet answers predecessor queries in time. It can be built by successive insertion in time. Preparing and sorting takes time per batch. Together with the sampled rank structure on , this yields BBS rank operations in time.
The following lemma addresses the implementation of the operations on the logical edit representation of Sect. 6; the factor-by-factor decoding invariant I3 is stated before Lemma 6.1.
Lemma 8.3 (Accelerated inversion batch). Let be the static transform of length at the start of an inversion batch, let , and assume . The deletion representation of Sect. 6, including the single virtual or temporarily substituted delimiter, supports each destructive FL-step in time and uses additional words. The batch structures are initialized in time.
Proof. Rank-compress the alphabet once to , retaining the original letters for output, in time and words.
Partition into blocks of length . For every , maintain surviving counts per block in a high-degree searchable partial-sums tree (Lemma 8.1). Scanning initializes these trees in time and words; decrements, prefix counts, and block selection take time.
Scan the selected block, skipping excluded coordinates via links between successive exclusions. A dynamic fusion tree [16] supplies their predecessor and rank in time, so one predecessor search suffices for an -time scan. A static coordinate maps to logical position , adjusted by one comparison for the delimiter, whose position is stored separately.
An scan of the surviving letter totals, with the stored delimiter-presence bit, determines and its cumulative count. Replacing an ordinary coordinate by the delimiter decrements one block count and inserts into ; an old delimiter coordinate is already excluded and needs no second decrement. Virtual delimiter changes affect only constant-size state. The claimed bounds follow.
Initialization cost. Initializing counters and rebuilding nodes costs per batch, already incurred by sampled ranks in Sect. 5.2. Over all batches this is when , which we assume below.
The ordinary BWT uses the same BBS, so the acceleration applies to both transforms.
Theorem 8.4. Let be a text of length , and let . We can compute the (B)BWT in time using additional space, assuming . Here
denotes the maximum alphabet size charged to a batch. For inversion, we obtain the same time bound in additional space under the corresponding assumption .
Proof. In a construction batch, stays fixed and at most insertions are stored as breakpoints.
We scan once to compute and the static rank samples: for each , we record its prefix frequency at the segment boundaries. Each scanned letter requires one predecessor query in the batch alphabet, taking time.
By Lemma 8.2, breakpoint operations cost amortized time, with rebuilding charged separately. Direct scans and materialization add time. Thus, a batch of static length costs
since .
Let be the static transform length at the start of batch . Since there are batches and , we have . The space bound follows from Lemma 8.2.
For inversion, Lemma 8.3 gives initialization time and time per step. With at most steps per batch, the total is time. The condition absorbs the last term, including initial rank compression.
Refinement. The static scans more precisely take time. For , this is time, improving on the uniform bound for small . If batch-alphabet lookup is constant time, the static scans become linear in their lengths. Since , this holds when , even for large global alphabets. It may also hold for much larger , for example when . The next theorem uses the weaker condition .
Theorem 8.5. Let and . If , i.e. each batch alphabet has size , we can compute the (B)BWT in time using additional space. For inversion, we obtain the same bounds by replacing with , under the corresponding hypothesis .
Proof. With , a dynamic fusion tree answers batch-alphabet predecessor and equality queries in time [16]. Key preparation takes time. Each scanned letter of can then be located in the batch alphabet in constant time, so building and rank samples takes . The at most dynamic operations cost each by Lemma 8.2. The batch cost is therefore time. Summing over batches and using gives time.
Where the second term matters. The additive term in the time bound of Thm. 8.5 is dominated by unless ; thus the primary gain over Thm. 3.2 is in the first term.
For , the at most pending breakpoints can instead be maintained in a sorted array. Each insertion or pending-breakpoint query takes time, contributing overall. Thus, balanced search trees become necessary for our time bounds only when .
Our construction uses additional words, which is sublinear if . This condition restricts the number of distinct letters within each batch, but not necessarily the global alphabet size , since different batches may contain different letters.
9 Pointer-Machine Interpretation
The basic trade-off does not require constant-time indexed access to the working string X. On a pointer machine, we instead assume that the input is supplied as an ordered tree with n writable leaves, storing the text in left-to-right order. The leaves form a doubly linked list, and pointers to its ends are available. The given tree and leaf links are part of the input/output representation, not additional workspace; the output overwrites the leaf labels without changing their order. We allow constant-time comparisons and arithmetic on positional counters, but no word-parallel operations.
All traversals of the working string can then use fingers (pointers to leaves). Duval's factorization keeps fingers (represented by the state Q) at its active positions; resetting one finger to another takes constant time, while advancing along the leaf list retains the standard linear-time bound. Each factor is reversed by swapping labels from its two ends. During a batch, pointers to the sampled segment boundaries locate the starts of static scans, and the BBS trees locate the segment containing a queried logical position. Materialization traverses the leaves right to left for construction and left to right for inversion. None of these operations needs to reach a leaf by its numerical index.
Consequently, the comparison-based construction and inversion bounds of Thm. 3.2 remain valid, with the same and additional space bounds, respectively, recalling that the space is relative to the given linked-leaf representation.
References
[1] Hideo Bannai, Juha Kärkkäinen, Dominik Köppl, and Marcin Piątkowski. Constructing and indexing the bijective and extended Burrows-Wheeler transform. Inf. Comput., 297 (105153):1–30, 2024. doi: 10.1016/j.ic.2024.105153.
[2] Hideo Bannai, Dominik Köppl, and Zsuzsanna Lipták. A survey of the bijective burrows-wheeler transform. In The Expanding World of Compressed Data: A Festschrift for Giovanni Manzini's 60th Birthday, volume 131 of OASIcs, pages 2:1–2:26, 2025. doi: 10.4230/OASIcs.Manzini.2.
[3] Michael Burrows and David J. Wheeler. A block sorting lossless data compression algorithm. Technical Report 124, Digital Equipment Corporation, Palo Alto, California, 1994.
[4] Maxime Crochemore, Roberto Grossi, Juha Kärkkäinen, and Gad M. Landau. Computing the Burrows-Wheeler transform in place and in small space. J. Discrete Algorithms, 32: 44–52, 2015. doi: 10.1016/j.jda.2015.01.004.
[5] Charles Crowley. Data structures for text sequences. Technical report, University of New Mexico, 1998. URL https://www.cs.unm.edu/~crowley/papers/sds.pdf.
[6] Felipe Alves da Louza, Travis Gagie, and Guilherme P. Telles. Burrows-Wheeler transform and LCP array construction in constant space. J. Discrete Algorithms, 42:14–22, 2017. doi: 10.1016/j.jda.2016.11.003.
[7] Tomohiro I, Dominik Köppl, Hiroshi Sakamoto, and Sohei Yamaguchi. Space-efficient B trees via load-balancing. Theory of Computing Systems, 69(32):1–26, 2025. doi: 10.1007/s00224-025-10238-7.
[8] Dominik Kempa and Tomasz Kociumaka. String synchronizing sets: sublinear-time BWT construction and optimal LCE data structure. In Proc. STOC, pages 756–767, 2019. doi: 10.1145/3313276.3316368.
[9] Dominik Köppl, Daiki Hashimoto, Diptarama Hendrian, and Ayumi Shinohara. In-place bijective Burrows-Wheeler transforms. In Proc. CPM, volume 161 of LIPIcs, pages 21:1–21:15, 2020. doi: 10.4230/LIPIcs.CPM.2020.21. [10] Sabrina Mantaci, Antonio Restivo, Giovanna Rosone, and Marinella Sciortino. An extension of the Burrows-Wheeler transform. Theor. Comput. Sci., 387(3):298–312, 2007. doi: 10.1016/j.tcs.2007.07.014. [11] William Newman. Design case study: the bravo text editor. Interactions, 19(1):75–80, 2012. doi: 10.1145/2065327.2065342. URL https://doi.org/10.1145/2065327.2065342. [12] Ge Nong, Sen Zhang, and Wai Hong Chan. Linear suffix array construction by almost pure induced-sorting. In Proc. DCC, pages 193–202, 2009. doi: 10.1109/DCC.2009.42. [13] Jannik Olbrich. Fast and memory-efficient BWT construction of repetitive texts using Lyndon grammars. In Proc. ESA, volume 351 of LIPIcs, pages 60:1–60:19, 2025. doi: 10.4230/LIPICS.ESA.2025.60. [14] Jannik Olbrich, Enno Ohlebusch, and Thomas Büchler. Generic non-recursive suffix array construction. ACM Trans. Algorithms, 20(2):18, 2024. doi: 10.1145/3641854. [15] Mihai Pătrașcu and Erik D. Demaine. Tight bounds for the partial-sums problem. In Proc. SODA, pages 20–29, 2004. URL http://dl.acm.org/citation.cfm?id=982792.982796. [16] Mihai Patrascu and Mikkel Thorup. Dynamic integer sets with optimal rank, select, and predecessor search. In Proc. FOCS, pages 166–175, 2014. doi: 10.1109/FOCS.2014.26.