ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
MonotoneSearch.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*------------------------- File MonotoneSearch.h --------------------------*/
3
/*--------------------------------------------------------------------------*/
56
/*--------------------------------------------------------------------------*/
57
/*----------------------------- DEFINITIONS --------------------------------*/
58
/*--------------------------------------------------------------------------*/
59
60
#ifndef __ADS_MonotoneSearch
61
#define __ADS_MonotoneSearch
62
/* self-identification: #endif constant */
63
64
/*--------------------------------------------------------------------------*/
65
/*------------------------------ INCLUDES ----------------------------------*/
66
/*--------------------------------------------------------------------------*/
67
68
#include "
ADS/Contract.h
"
69
#include "
ADS/sort/Sorted.h
"
70
71
#include <concepts>
72
#include <cstddef>
73
#include <limits>
74
#include <type_traits>
75
76
/*--------------------------------------------------------------------------*/
77
/*--------------------------- NAMESPACE ------------------------------------*/
78
/*--------------------------------------------------------------------------*/
79
80
namespace
ADS
81
{
82
108
template
< std::
int
egral I ,
class
P >
109
I
exponentialSearch
( P && p , I lo = I( 0 ) );
110
128
template
<
class
G ,
class
P >
129
std::size_t
unboundedSearch
( G && get , P && pred );
130
151
template
< std::
unsigned
_
int
egral U >
152
U
integerSqrt
( U n );
153
156
template
< std::
unsigned
_
int
egral U >
157
bool
isPerfectSquare
( U n );
158
159
/*--------------------------------------------------------------------------*/
160
161
}
// end( namespace ADS )
162
163
/*--------------------------------------------------------------------------*/
164
/*-------------------------- IMPLEMENTATION --------------------------------*/
165
/*--------------------------------------------------------------------------*/
166
167
#include "ADS/search/impl/MonotoneSearch.tpp"
168
169
/*--------------------------------------------------------------------------*/
170
171
#endif
/* MonotoneSearch.h included */
172
173
/*--------------------------------------------------------------------------*/
174
/*----------------------- End File MonotoneSearch.h ------------------------*/
175
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
Sorted.h
The checks of the contracts of the sorts [see Contract.h]: a copy of the input kept only when the aud...
ADS::isPerfectSquare
bool isPerfectSquare(U n)
true if for an integer , i.e., if the square of integerSqrt( n ) is
ADS::unboundedSearch
std::size_t unboundedSearch(G &&get, P &&pred)
the first place where get( i ), which gives an optional item, empty past the end of the sequence,...
ADS::integerSqrt
U integerSqrt(U n)
the largest with , by a binary search with no overflow; steps for bits, none for a bool,...
ADS::exponentialSearch
I exponentialSearch(P &&p, I lo=I(0))
the least with , false and then true from ; evaluations of
ADS
Definition
ADT.h:96
ADS
search
MonotoneSearch.h
Generated by
1.17.0