65#ifndef __ADS_PrefixSearch
66 #define __ADS_PrefixSearch
111[[nodiscard]]
inline std::size_t
113 std::string_view Q );
136[[nodiscard]]
inline std::size_t
137prefixEnd(
const std::vector< std::string > & A , std::string_view P );
152[[nodiscard]]
inline std::pair< std::size_t , std::size_t >
153prefixRange(
const std::vector< std::string > & A , std::string_view P );
158 std::string_view b );
164[[nodiscard]]
inline bool precedes( std::string_view s , std::string_view P ,
169[[nodiscard]]
inline std::uint64_t prefixKey( std::string_view s );
221 [[nodiscard]] std::size_t
position( std::uint64_t y )
const;
225 [[nodiscard]]
bool contains( std::uint64_t y )
const;
228 [[nodiscard]] std::size_t
bins(
void )
const;
231 [[nodiscard]] std::uint64_t
width(
void )
const;
236 [[nodiscard]] std::pair< std::size_t , std::size_t >
237 bin( std::size_t j )
const;
241 [[nodiscard]] std::optional< std::size_t >
binOf( std::uint64_t y )
const;
247 [[nodiscard]] std::size_t
size(
void )
const;
250 [[nodiscard]]
const std::vector< std::uint64_t > &
items(
void )
const;
253 std::vector< std::uint64_t > f_X;
254 std::uint64_t f_b = 1;
255 std::vector< std::size_t > f_start;
314 [[nodiscard]] std::size_t
prefixEnd( std::string_view P )
const;
318 [[nodiscard]] std::pair< std::size_t , std::size_t >
327 [[nodiscard]] std::size_t rank( std::string_view P ,
bool upper ,
328 std::uint64_t k )
const;
330 std::vector< std::string > f_A;
342#include "ADS/string/impl/PrefixSearch.tpp"
The binary search of section 1.2 in a sorted vector : is compared with the middle item of the part ...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
the search by interpolation of a sorted array of integers by bins
Definition PrefixSearch.h:179
bool contains(std::uint64_t y) const
whether is an item, i.e., at the place that position( y ) gives
const std::vector< std::uint64_t > & items(void) const
the sorted array
std::size_t size(void) const
the number of items
std::uint64_t width(void) const
the width of a bin
std::pair< std::size_t, std::size_t > bin(std::size_t j) const
the places of in the bin
std::size_t largestBin(void) const
the number of items of the largest bin
BinnedSearch(std::vector< std::uint64_t > X)
the bins of , in
std::optional< std::size_t > binOf(std::uint64_t y) const
the bin of , or none if is out of
std::size_t bins(void) const
the number of bins
std::size_t position(std::uint64_t y) const
the number of items smaller than
std::size_t lexicographicPosition(std::string_view Q) const
the number of strings smaller than
std::pair< std::size_t, std::size_t > prefixRange(std::string_view P) const
the range of the strings prefixed by , by lexicographicPosition() and prefixEnd()
std::size_t prefixEnd(std::string_view P) const
the number of strings smaller than
const BinnedSearch & keys(void) const
the BinnedSearch of the integers of the strings
BinnedStringSearch(std::vector< std::string > A)
the bins of the integers of the first 8 characters of , a BinnedSearch on them
std::size_t commonPrefixLength(std::string_view a, std::string_view b)
the length of the longest common prefix of and , by comparing them from their start
std::size_t prefixEnd(const std::vector< std::string > &A, std::string_view P)
the number of strings of the sorted smaller than , i.e., smaller than or prefixed by
std::size_t lexicographicPosition(const std::vector< std::string > &A, std::string_view Q)
the number of strings of the sorted smaller than
std::pair< std::size_t, std::size_t > prefixRange(const std::vector< std::string > &A, std::string_view P)
the range of the strings of the sorted prefixed by