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
sdsl::nearest_neighbour_dictionary< sample_dens > Class Template Reference

Nearest neighbour dictionary for sparse uniform sets (described in Geary et al., A Simple Optimal Representation for Balanced Parentheses, CPM 2004). More...

#include <nearest_neighbour_dictionary.hpp>

List of all members.

Public Types

typedef bit_vector::size_type size_type

Public Member Functions

 nearest_neighbour_dictionary ()
 Default constructor.
 nearest_neighbour_dictionary (const bit_vector &v)
 Constructor.
 nearest_neighbour_dictionary (const nearest_neighbour_dictionary &nnd)
 Copy constructor.
 ~nearest_neighbour_dictionary ()
 Destructor.
nearest_neighbour_dictionaryoperator= (const nearest_neighbour_dictionary &nnd)
void swap (nearest_neighbour_dictionary &nnd)
size_type rank (size_type idx) const
 Answers rank queries for the supported bit_vector.
size_type select (size_type i) const
 Answers select queries for the supported bit_vector.
size_type prev (size_type i) const
 Answers "previous occurence of one" queries for the supported bit_vector.
size_type next (size_type i) const
size_type size () const
size_type ones () const
size_type serialize (std::ostream &out, structure_tree_node *v=NULL, std::string name="") const
 Serializes the nearest_neighbour_dictionary.
void load (std::istream &in)
 Loads the nearest_neighbour_dictionary.

Detailed Description

template<uint8_t sample_dens>
class sdsl::nearest_neighbour_dictionary< sample_dens >

Nearest neighbour dictionary for sparse uniform sets (described in Geary et al., A Simple Optimal Representation for Balanced Parentheses, CPM 2004).

Template parameter sample_dens corresponds to parameter t in the paper. The data structure the following methods:


Constructor & Destructor Documentation

template<uint8_t sample_dens>
sdsl::nearest_neighbour_dictionary< sample_dens >::nearest_neighbour_dictionary ( const bit_vector v) [inline]

Constructor.

Parameters:
vThe supported bit_vector.

Member Function Documentation

template<uint8_t sample_dens>
void sdsl::nearest_neighbour_dictionary< sample_dens >::load ( std::istream &  in) [inline]

Loads the nearest_neighbour_dictionary.

Parameters:
inIn-Stream to load the rank_support data from.
template<uint8_t sample_dens>
size_type sdsl::nearest_neighbour_dictionary< sample_dens >::next ( size_type  i) const [inline]

Answers "next occurence of one" queries for the supported bit_vector.

Parameters:
iPosition $ i \in [0..size()-1] $.
Returns:
The minimal position $ j \geq i $ where the supported bit_vector v equals 1.
Precondition:
rank(i) < ones()
Time complexity $ j \geq i $#51
template<uint8_t sample_dens>
size_type sdsl::nearest_neighbour_dictionary< sample_dens >::prev ( size_type  i) const [inline]

Answers "previous occurence of one" queries for the supported bit_vector.

Parameters:
iPosition $ i \in [0..size()-1] $.
Returns:
The maximal position $j \leq i$ where the supported bit_vector v equals 1.
Precondition:
rank(i+1)>0
Time complexity $j \leq i$#51
template<uint8_t sample_dens>
size_type sdsl::nearest_neighbour_dictionary< sample_dens >::rank ( size_type  idx) const [inline]

Answers rank queries for the supported bit_vector.

Parameters:
idxArgument for the length of the prefix v[0..idx-1].
Returns:
Number of 1-bits in the prefix [0..idx-1] of the supported bit_vector.
Time complexity #51
template<uint8_t sample_dens>
size_type sdsl::nearest_neighbour_dictionary< sample_dens >::select ( size_type  i) const [inline]

Answers select queries for the supported bit_vector.

Parameters:
iSelect the $i$th 1 in the supported bit_vector. $i\in [1..ones()]$
Returns:
The position of the $i$th 1 in the supported bit_vector.
Time complexity $i$#51
template<uint8_t sample_dens>
size_type sdsl::nearest_neighbour_dictionary< sample_dens >::serialize ( std::ostream &  out,
structure_tree_node v = NULL,
std::string  name = "" 
) const [inline]

Serializes the nearest_neighbour_dictionary.

Parameters:
outOut-Stream to serialize the data to.

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