ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
KnuthSearches.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*-------------------------- File KnuthSearches.h --------------------------*/
3
/*--------------------------------------------------------------------------*/
46
/*--------------------------------------------------------------------------*/
47
/*----------------------------- DEFINITIONS --------------------------------*/
48
/*--------------------------------------------------------------------------*/
49
50
#ifndef __ADS_KnuthSearches
51
#define __ADS_KnuthSearches
52
/* self-identification: #endif constant */
53
54
/*--------------------------------------------------------------------------*/
55
/*------------------------------ INCLUDES ----------------------------------*/
56
/*--------------------------------------------------------------------------*/
57
58
#include "
ADS/Contract.h
"
59
60
#include <algorithm>
61
#include <cstddef>
62
#include <vector>
63
64
/*--------------------------------------------------------------------------*/
65
/*--------------------------- NAMESPACE ------------------------------------*/
66
/*--------------------------------------------------------------------------*/
67
68
namespace
ADS
69
{
70
98
template
<
class
T >
99
long
fibonacciSearch
(
const
std::vector< T > & A ,
const
T & v ,
100
long
* cmp =
nullptr
);
101
127
template
<
class
T >
128
long
uniformBinarySearch
(
const
std::vector< T > & A ,
const
T & v ,
129
long
* cmp =
nullptr
);
130
131
/*--------------------------------------------------------------------------*/
132
133
}
// end( namespace ADS )
134
135
/*--------------------------------------------------------------------------*/
136
/*-------------------------- IMPLEMENTATION --------------------------------*/
137
/*--------------------------------------------------------------------------*/
138
139
#include "ADS/search/impl/KnuthSearches.tpp"
140
141
/*--------------------------------------------------------------------------*/
142
143
#endif
/* KnuthSearches.h included */
144
145
/*--------------------------------------------------------------------------*/
146
/*------------------------ End File KnuthSearches.h ------------------------*/
147
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::fibonacciSearch
long fibonacciSearch(const std::vector< T > &A, const T &v, long *cmp=nullptr)
the Fibonacci search of in the sorted : its place, or -1; the comparisons go to *cmp,...
ADS::uniformBinarySearch
long uniformBinarySearch(const std::vector< T > &A, const T &v, long *cmp=nullptr)
the uniform binary search of in the sorted : its place, or -1; the comparisons go to *cmp,...
ADS
Definition
ADT.h:96
ADS
search
KnuthSearches.h
Generated by
1.17.0