a Patricia trie on the anchors of a front-coded dictionary
More...
#include <ADS/dictionary/TwoLevelDictionary.h>
|
| | TwoLevelDictionary (FrontCodedDictionary F) |
| | the trie on the anchors of the coding \( F \)
|
| std::size_t | lexicographicPosition (std::string_view Q) const |
| | the number of strings smaller than \( Q \)
|
| std::size_t | prefixEnd (std::string_view P) const |
| | the number of strings smaller than \( P\# \), \( \# \) larger than every character, i.e., of the strings smaller than \( P \) or prefixed by it; as lexicographicPosition(), with \( P\# \) in the place of \( Q \)
|
| std::pair< std::size_t, std::size_t > | prefixRange (std::string_view P) const |
| | the range \( [ l , r ) \) of the strings prefixed by \( P \)
|
| std::string | access (std::size_t i) const |
| | the string \( i \), decoded from its bucket
|
| std::size_t | size (void) const |
| | the number of strings
|
| const PatriciaTrie & | upper (void) const |
| | the upper level, the trie on the anchors
|
| const FrontCodedDictionary & | lower (void) const |
| | the lower level, the front coding of the strings
|
| const_iterator | begin (void) const |
| | the iterator on the first item
|
| const_iterator | end (void) const |
| | the iterator past the last item
|
| const_iterator | cbegin (void) const |
| | the constant iterator on the first item
|
| const_iterator | cend (void) const |
| | the constant iterator past the last item
|
a Patricia trie on the anchors of a front-coded dictionary
◆ const_iterator
the iterator on the items, constant
◆ const_reference
a constant reference to an item
◆ difference_type
the type of the distances between two iterators
◆ iterator
the iterator on the items
◆ reference
◆ size_type
◆ value_type
the type of the items, for the standard library
◆ TwoLevelDictionary()
the trie on the anchors of the coding \( F \)
◆ access()
| std::string ADS::TwoLevelDictionary::access |
( |
std::size_t | i | ) |
const |
|
nodiscard |
the string \( i \), decoded from its bucket
- Precondition
- \( i \) is less than size()
◆ begin()
the iterator on the first item
◆ cbegin()
the constant iterator on the first item
◆ cend()
the constant iterator past the last item
◆ end()
the iterator past the last item
◆ lexicographicPosition()
| std::size_t ADS::TwoLevelDictionary::lexicographicPosition |
( |
std::string_view | Q | ) |
const |
|
nodiscard |
the number of strings smaller than \( Q \)
In pseudocode (chapter 9 of Ferragina), the trie in memory and the buckets of the coding on disk:
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{lexicographicPosition}( Q ) \cr
2 & \quad j \gets T.\mathrm{lexicographicPosition}( Q )\quad
\triangleright\ \text{the blind search among the anchors} \cr
3 & \quad \textbf{return}\ \text{the rank of } Q \text{ in the bucket }
\text{of the anchor } j \text{, decoded on the fly}
\end{array}}
\]
- Postcondition
- the strings before the result are smaller than \( Q \), the others are not
◆ lower()
the lower level, the front coding of the strings
◆ prefixEnd()
| std::size_t ADS::TwoLevelDictionary::prefixEnd |
( |
std::string_view | P | ) |
const |
|
nodiscard |
the number of strings smaller than \( P\# \), \( \# \) larger than every character, i.e., of the strings smaller than \( P \) or prefixed by it; as lexicographicPosition(), with \( P\# \) in the place of \( Q \)
- Postcondition
- the strings before the result precede \( P\# \), the others do not
◆ prefixRange()
| std::pair< std::size_t, std::size_t > ADS::TwoLevelDictionary::prefixRange |
( |
std::string_view | P | ) |
const |
|
nodiscard |
the range \( [ l , r ) \) of the strings prefixed by \( P \)
In pseudocode (chapter 9 of Ferragina):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{prefixRange}( P ) \cr
2 & \quad \textbf{return}\ ( \mathrm{lexicographicPosition}( P ) ,
\mathrm{prefixEnd}( P ) )
\end{array}}
\]
◆ size()
| std::size_t ADS::TwoLevelDictionary::size |
( |
void | | ) |
const |
|
nodiscard |
◆ upper()
| const PatriciaTrie & ADS::TwoLevelDictionary::upper |
( |
void | | ) |
const |
|
nodiscard |
the upper level, the trie on the anchors
The documentation for this class was generated from the following file: