88#ifndef __ADS_RangeMinimum
89 #define __ADS_RangeMinimum
137template<
class T ,
class Compare = std::less< T > >
138[[nodiscard]] std::vector< std::size_t >
146template<
class T ,
class Compare = std::less< T > >
190 [[nodiscard]] std::size_t
query( std::size_t i , std::size_t j )
const;
193 [[nodiscard]] std::size_t
size(
void )
const {
return( f_A.size() ); }
224 [[nodiscard]] std::size_t better( std::size_t a , std::size_t b )
const;
226 std::vector< T > f_A;
227 std::vector< std::vector< std::size_t > > f_M;
292 [[nodiscard]] std::size_t
query( std::size_t i , std::size_t j )
const;
295 [[nodiscard]] std::size_t
size(
void )
const {
return( f_D.size() ); }
298 [[nodiscard]] std::size_t
blockSize(
void )
const {
return( f_d ); }
304 [[nodiscard]] std::size_t inBlock( std::size_t k , std::size_t a ,
305 std::size_t b )
const;
307 std::vector< long > f_D;
309 std::vector< std::uint32_t > f_sig;
310 std::vector< std::uint8_t > f_table;
311 std::vector< std::size_t > f_blockMin;
322template<
class T ,
class Compare = std::less< T > >
363 [[nodiscard]] std::size_t
query( std::size_t i , std::size_t j )
const;
366 [[nodiscard]] std::size_t
size(
void )
const {
return( f_A.size() ); }
374 [[nodiscard]]
const std::vector< std::size_t > &
eulerTour(
void )
const {
402 std::vector< T > f_A;
403 std::vector< std::size_t > f_E;
404 std::vector< std::size_t > f_first;
418#include "ADS/search/impl/RangeMinimum.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
the range minima of an array whose adjacent items differ by 1
Definition RangeMinimum.h:238
PlusMinusOneRangeMinimum(void)=default
an empty structure
std::size_t blockSize(void) const
the number of items in a block
Definition RangeMinimum.h:298
PlusMinusOneRangeMinimum(std::vector< long > D)
the blocks, their sparse table and the table of the signatures,
std::size_t size(void) const
the number of the items
Definition RangeMinimum.h:295
std::size_t query(std::size_t i, std::size_t j) const
the place of the leftmost minimum of ,
typename std::vector< T >::const_iterator const_iterator
an iterator on the items
Definition RangeMinimum.h:387
const T & operator[](std::size_t i) const
the item of place
std::size_t size(void) const
the number of the items
Definition RangeMinimum.h:366
const_iterator cbegin(void) const
the first item
Definition RangeMinimum.h:396
const_iterator begin(void) const
the first item
Definition RangeMinimum.h:392
RangeMinimum(std::vector< T > A, Compare less={})
the structure of ,
const T & const_reference
a reference to an item
Definition RangeMinimum.h:385
std::ptrdiff_t difference_type
the type of the distances
Definition RangeMinimum.h:384
std::size_t query(std::size_t i, std::size_t j) const
the place of the leftmost minimum of ,
const_reference reference
the same, constant
Definition RangeMinimum.h:386
const_iterator end(void) const
past the last item
Definition RangeMinimum.h:394
std::size_t size_type
the type of the sizes
Definition RangeMinimum.h:383
T value_type
the type of the items
Definition RangeMinimum.h:382
RangeMinimum(void)=default
an empty structure
const_iterator iterator
the same, constant
Definition RangeMinimum.h:389
const_iterator cend(void) const
past the last item
Definition RangeMinimum.h:398
const std::vector< std::size_t > & eulerTour(void) const
the nodes of the Euler tour of the Cartesian tree, of them
Definition RangeMinimum.h:374
typename std::vector< T >::const_iterator const_iterator
an iterator on the items
Definition RangeMinimum.h:208
const_reference reference
the same, constant
Definition RangeMinimum.h:207
SparseTable(void)=default
an empty table
const_iterator cend(void) const
past the last item
Definition RangeMinimum.h:219
const T & operator[](std::size_t i) const
the item of place
SparseTable(std::vector< T > A, Compare less={})
the table of ,
const_iterator end(void) const
past the last item
Definition RangeMinimum.h:215
const_iterator begin(void) const
the first item
Definition RangeMinimum.h:213
const_iterator iterator
the same, constant
Definition RangeMinimum.h:210
std::size_t size(void) const
the number of the items
Definition RangeMinimum.h:193
std::ptrdiff_t difference_type
the type of the distances
Definition RangeMinimum.h:205
std::size_t query(std::size_t i, std::size_t j) const
the place of the leftmost minimum of ,
const T & const_reference
a reference to an item
Definition RangeMinimum.h:206
std::size_t size_type
the type of the sizes
Definition RangeMinimum.h:204
T value_type
the type of the items
Definition RangeMinimum.h:203
const_iterator cbegin(void) const
the first item
Definition RangeMinimum.h:217
std::vector< std::size_t > cartesianTree(const std::vector< T > &A, Compare less={})
the parent of each item of in its Cartesian tree, the root (the leftmost minimum) having ; equal ite...