SDSL: Succinct Data Structure Library
A C++ template library for succinct data structures
|
A Wavelet Tree class for byte sequences. More...
#include <wt_rlmn.hpp>
Public Types | |
typedef int_vector::size_type | size_type |
typedef unsigned char | value_type |
typedef BitVector | bit_vector_type |
typedef RankSupport | rank_support_type |
typedef SelectSupport | select_support_type |
typedef WaveletTree | wt_type |
Public Member Functions | |
wt_rlmn (const unsigned char *rac, size_type size) | |
Constructor. | |
template<class size_type_class > | |
wt_rlmn (int_vector_file_buffer< 8, size_type_class > &rac, size_type size) | |
template<class size_type_class > | |
void | construct (int_vector_file_buffer< 8, size_type_class > &rac, size_type size) |
Construct the wavelet tree from a random access container. | |
wt_rlmn (const wt_rlmn &wt) | |
Copy constructor. | |
wt_rlmn & | operator= (const wt_rlmn &wt) |
Assignment operator. | |
void | swap (wt_rlmn &wt) |
Swap operator. | |
size_type | size () const |
Returns the size of the original vector. | |
bool | empty () const |
Returns whether the wavelet tree contains no data. | |
value_type | operator[] (size_type i) const |
Recovers the ith symbol of the original vector. | |
size_type | rank (size_type i, value_type c) const |
Calculates how many symbols c are in the prefix [0..i-1] of the supported vector. | |
size_type | rank_ith_symbol (size_type i, value_type &c) const |
Calculates how many occurences of symbol wt[i] are in the prefix [0..i-1] of the supported sequence. | |
size_type | select (size_type i, value_type c) const |
Calculates the ith occurence of the symbol c in the supported vector. | |
size_type | serialize (std::ostream &out, structure_tree_node *v=NULL, std::string name="") const |
Serializes the data structure into the given ostream. | |
void | load (std::istream &in) |
Loads the data structure from the given istream. | |
void | print_info () const |
Public Attributes | |
const size_type & | sigma |
A Wavelet Tree class for byte sequences.
A wavelet tree is build for a vector of characters over the alphabet . This class should be used only for small alphabets (see wt_int for a wavelet tree for big alphabets). The wavelet tree consists of a tree of bitvectors and provides three efficient methods:
The select method: returns the index of the jth occurrence of symbol .
BitVector | Type of the bitvector which is used to represent bf and bl which mark the head of each run in the original sequence. |
RankSupport | Type of the rank support for bitvectors bf and bl. |
SelectSupport | Type of the select support for bitvectors bf and lb. |
WaveletTree | Type of the wavelet tree for the string consisting of the heads of the runs of the original sequence. |
sdsl::wt_rlmn< BitVector, RankSupport, SelectSupport, WaveletTree >::wt_rlmn | ( | const unsigned char * | rac, |
size_type | size | ||
) | [inline] |
Constructor.
\param rac Reference to the vector (or unsigned char array) for which the wavelet tree should be build. \param size Size of the prefix of the vector (or unsigned char array) for which the wavelet tree should be build. \par Time complexity
, where
void sdsl::wt_rlmn< BitVector, RankSupport, SelectSupport, WaveletTree >::construct | ( | int_vector_file_buffer< 8, size_type_class > & | rac, |
size_type | size | ||
) | [inline] |
Construct the wavelet tree from a random access container.
rac | A random access container |
size | The length of the prefix of the random access container, for which the wavelet tree should be build |
value_type sdsl::wt_rlmn< BitVector, RankSupport, SelectSupport, WaveletTree >::operator[] | ( | size_type | i | ) | const [inline] |
Recovers the ith symbol of the original vector.
i | The index of the symbol in the original vector. |
size_type sdsl::wt_rlmn< BitVector, RankSupport, SelectSupport, WaveletTree >::rank | ( | size_type | i, |
value_type | c | ||
) | const [inline] |
Calculates how many symbols c are in the prefix [0..i-1] of the supported vector.
i | The exclusive index of the prefix range [0..i-1], so . |
c | The symbol to count the occurences in the prefix. |
size_type sdsl::wt_rlmn< BitVector, RankSupport, SelectSupport, WaveletTree >::rank_ith_symbol | ( | size_type | i, |
value_type & | c | ||
) | const [inline] |
Calculates how many occurences of symbol wt[i] are in the prefix [0..i-1] of the supported sequence.
\param i The index of the symbol.
c | Reference that will contain the symbol at position i after the execution of the method. |
size_type sdsl::wt_rlmn< BitVector, RankSupport, SelectSupport, WaveletTree >::select | ( | size_type | i, |
value_type | c | ||
) | const [inline] |
Calculates the ith occurence of the symbol c in the supported vector.
i | The ith occurence. . |
c | The symbol c. |