For the example of $x=\sa{banana}\endmarker$ we get $\BWT(x)=\sa{annb}\endmarker\sa{aa}$:
$\BWT(x)$ | |||||||
$\sa{a}$ | $\endmarker$ | ||||||
$\sa{n}$ | $\sa{a}$ | $\endmarker$ | |||||
$\sa{n}$ | $\sa{a}$ | $\sa{n}$ | $\sa{a}$ | $\endmarker$ | |||
$\sa{b}$ | $\sa{a}$ | $\sa{n}$ | $\sa{a}$ | $\sa{n}$ | $\sa{a}$ | $\endmarker$ | |
$\endmarker$ | $\sa{b}$ | $\sa{a}$ | $\sa{n}$ | $\sa{a}$ | $\sa{n}$ | $\sa{a}$ | $\endmarker$ |
$\sa{a}$ | $\sa{n}$ | $\sa{a}$ | $\endmarker$ | ||||
$\sa{a}$ | $\sa{n}$ | $\sa{a}$ | $\sa{n}$ | $\sa{a}$ | $\endmarker$ |
Problem 96: In-place BW Transform |
The Burrows-Wheeler transform ($\BWT$) of a word can be computed in linear time, over a linear-sortable alphabet, using linear space. This is achieved via a method to sort the suffixes or conjugates of the word, which requires linear extra space in addition to the input.
The problem shows how the input word is changed to its transform with constant additional memory space but with a slower computation.
Let $x$ be a fixed word of length $n$ whose last letter is the end-marker $\endmarker$, smaller than all other letters. Sorting the conjugates of $x$ to get $\BWT(x)$ then amounts to sorting its suffixes. The transform is composed of letters preceding suffixes (circularly for the end-marker).