$\tau_3 = \sa{01101001}$ and $\SA_3 = [5,6,3,0,7,4,2,1]$.
Problem 54: Sorting Suffixes of Thue-Morse Words |
Thue-Morse words with their special structure provide examples in which some algorithms running in linear time or more can be optimised to run in logarithmic time instead. The problem shows such an example related to the Suffix array of words.
The infinite Thue-Morse word results from the iteration of the Thue-Morse morphism $\mu$ from $\{\sa{0}, \sa{1}\}^*$ to itself defined by \[\cases{ \mu(\sa{0}) = \sa{01} &\cr \mu(\sa{1}) = \sa{10} &\cr } \]
The Thue-Morse word $\tau_n$ is $\mu^n(0)$, for a natural integer $n$. This type of description of Thue-Morse words is suitable to describe recursively the array $\SA_n$ that lists the starting positions of non-empty suffixes of $\tau_n$ sorted according to the lexicographic order of the suffixes.