SDSL: Succinct Data Structure Library
A C++ template library for succinct data structures
 All Classes Namespaces Files Functions Variables Typedefs Friends
Public Types | Public Member Functions | Public Attributes
sdsl::wt_rlg8< RankSupport, WaveletTree > Class Template Reference

A Wavelet Tree class for byte sequences. More...

#include <wt_rlg8.hpp>

List of all members.

Public Types

typedef int_vector::size_type size_type
typedef unsigned char value_type
typedef RankSupport rank_support_type
typedef WaveletTree wt_type

Public Member Functions

 wt_rlg8 (const unsigned char *rac, size_type size)
 Constructor.
template<class size_type_class >
 wt_rlg8 (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_rlg8 (const wt_rlg8 &wt)
 Copy constructor.
wt_rlg8operator= (const wt_rlg8 &wt)
 Assignment operator.
void swap (wt_rlg8 &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 occurrences 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 occurrence 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.

Public Attributes

const uint16_t & sigma

Detailed Description

template<class RankSupport = rank_support_v5<>, class WaveletTree = wt_without_select>
class sdsl::wt_rlg8< RankSupport, WaveletTree >

A Wavelet Tree class for byte sequences.

A wavelet tree is build for a vector of characters over the alphabet $\Sigma$. This class should be used only for small alphabets $\Sigma \ll n$ (see wt_int for a wavelet tree for big alphabets). The wavelet tree $wt$ consists of a tree of bitvectors and provides three efficient methods:


Constructor & Destructor Documentation

template<class RankSupport = rank_support_v5<>, class WaveletTree = wt_without_select>
sdsl::wt_rlg8< RankSupport, WaveletTree >::wt_rlg8 ( 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

$ \Order{n\log|\Sigma|}$, where $n=size$


Member Function Documentation

template<class RankSupport = rank_support_v5<>, class WaveletTree = wt_without_select>
template<class size_type_class >
void sdsl::wt_rlg8< RankSupport, WaveletTree >::construct ( int_vector_file_buffer< 8, size_type_class > &  rac,
size_type  size 
) [inline]

Construct the wavelet tree from a random access container.

Parameters:
racA random access container
sizeThe length of the prefix of the random access container, for which the wavelet tree should be build
template<class RankSupport = rank_support_v5<>, class WaveletTree = wt_without_select>
value_type sdsl::wt_rlg8< RankSupport, WaveletTree >::operator[] ( size_type  i) const [inline]

Recovers the ith symbol of the original vector.

Parameters:
iThe index of the symbol in the original vector. $i \in [0..size()-1]$
Returns:
The ith symbol of the original vector.
Time complexity
$ \Order{H_0 + \log L} $ on average, where $ H_0 $ is the zero order entropy of the sequence and $L$ the maximal length of a run in the sequence.
template<class RankSupport = rank_support_v5<>, class WaveletTree = wt_without_select>
size_type sdsl::wt_rlg8< RankSupport, 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.

Parameters:
iThe exclusive index of the prefix range [0..i-1], so $i\in[0..size()]$.
cThe symbol to count the occurrences in the prefix.
Returns:
The number of occurrences of symbol c in the prefix [0..i-1] of the supported vector.
Time complexity
$ \Order{H_0 \log L} $ on average, where $ H_0 $ is the zero order entropy of the sequence and $L$ the maximal length of a run of $c$s in the sequence.
template<class RankSupport = rank_support_v5<>, class WaveletTree = wt_without_select>
size_type sdsl::wt_rlg8< RankSupport, WaveletTree >::rank_ith_symbol ( size_type  i,
value_type &  c 
) const [inline]

Calculates how many occurrences of symbol wt[i] are in the prefix [0..i-1] of the supported sequence.

   \param i The index of the symbol.
Parameters:
cReference that will contain the symbol at position i after the execution of the method.
Returns:
The number of occurrences of symbol wt[i] in the prefix [0..i-1]
Time complexity
$ \Order{H_0 \log L} $
template<class RankSupport = rank_support_v5<>, class WaveletTree = wt_without_select>
size_type sdsl::wt_rlg8< RankSupport, WaveletTree >::select ( size_type  i,
value_type  c 
) const [inline]

Calculates the ith occurrence of the symbol c in the supported vector.

Parameters:
iThe ith occurrence. $i\in [1..rank(size(),c)]$.
cThe symbol c.
Time complexity
$ \Order{\log n H_0 \log L} $ on average, where $ H_0 $ is the zero order entropy of the sequence and $L$ the maximal length of a run of $c$s in the sequence.

The documentation for this class was generated from the following file: