|
ADS
Algorithms and Data Structures
|
The move structure of Nishimoto and Tabei: a permutation \( \pi \) of \( [ 0 , n ) \) that shifts each of \( m \) intervals alike, the interval \( [ p_i , p_{i+1} ) \) onto \( [ q_i , q_i + p_{i+1} - p_i ) \) (the LF-mapping of a transform of Burrows and Wheeler on its runs, the function \( \phi \) of the r-index on the places of the starts of the runs [see RIndex.h]), with \( \pi( x ) \) and the interval of \( \pi( x ) \) in \( O( 1 ) \) time from \( x \) and its interval, in \( O( m ) \) words rather than \( n \). More...
#include "ADS/Contract.h"#include "ADS/succinct/BitVector.h"#include <algorithm>#include <bit>#include <cstddef>#include <cstdint>#include <map>#include <span>#include <string_view>#include <utility>#include <vector>#include "ADS/succinct/impl/MoveStructure.tpp"Go to the source code of this file.
Classes | |
| class | ADS::MoveStructure |
| a permutation of \( [ 0 , n ) \) that shifts each of its intervals alike, with the image of a place and its interval in \( O( 1 ) \) time More... | |
Namespaces | |
| namespace | ADS |
The move structure of Nishimoto and Tabei: a permutation \( \pi \) of \( [ 0 , n ) \) that shifts each of \( m \) intervals alike, the interval \( [ p_i , p_{i+1} ) \) onto \( [ q_i , q_i + p_{i+1} - p_i ) \) (the LF-mapping of a transform of Burrows and Wheeler on its runs, the function \( \phi \) of the r-index on the places of the starts of the runs [see RIndex.h]), with \( \pi( x ) \) and the interval of \( \pi( x ) \) in \( O( 1 ) \) time from \( x \) and its interval, in \( O( m ) \) words rather than \( n \).
Each interval \( i \) keeps \( p_i \), \( q_i \) and the interval \( d_i \) that holds \( q_i \), so that
\[ \pi( x ) = q_i + ( x - p_i ) , \qquad x \in [ p_i , p_{i+1} ) , \]
and its interval is found from \( d_i \) forward, past the starts \( p_j \le \pi( x ) \). The structure is balanced: no image \( [ q_i , q_i + p_{i+1} - p_i ) \) holds 4 starts or more, which the construction ensures by cutting an interval whose image holds 4 starts at the third of them, so that the first part holds 2 (the new start may weigh on another image, which is checked in turn); the intervals become at most \( 2 m \) (Nishimoto and Tabei, for this balance), and the search forward takes at most 3 steps. The construction keeps the intervals and the images in two ordered maps, \( O( m \log m ) \) time. Each interval carries a tag of its own (the symbol of its run), which its parts keep.
The contracts [see Contract.h]: the intervals partition \( [ 0 , n ) \) and their images too, and the places and the intervals of move() agree; the audit of the construction is the balance. The functions are defined in MoveStructure.tpp.