ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
SequenceProblems.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*------------------------ File SequenceProblems.h -------------------------*/
3
/*--------------------------------------------------------------------------*/
62
/*--------------------------------------------------------------------------*/
63
/*----------------------------- DEFINITIONS --------------------------------*/
64
/*--------------------------------------------------------------------------*/
65
66
#ifndef __ADS_SequenceProblems
67
#define __ADS_SequenceProblems
68
/* self-identification: #endif constant */
69
70
/*--------------------------------------------------------------------------*/
71
/*------------------------------ INCLUDES ----------------------------------*/
72
/*--------------------------------------------------------------------------*/
73
74
#include "
ADS/Contract.h
"
75
76
#include <algorithm>
77
#include <concepts>
78
#include <cstddef>
79
#include <functional>
80
#include <unordered_map>
81
#include <utility>
82
#include <vector>
83
84
/*--------------------------------------------------------------------------*/
85
/*--------------------------- NAMESPACE ------------------------------------*/
86
/*--------------------------------------------------------------------------*/
87
88
namespace
ADS
89
{
90
113
template
<
class
T >
114
T
trappingRainWater
(
const
std::vector< T > & h );
115
140
template
< std::
int
egral T >
141
std::vector< T >
largestDivisibleSubset
( std::vector< T > A );
142
165
template
<
class
T >
166
T
maxSumIncreasingSubsequence
(
const
std::vector< T > & A );
167
188
template
<
class
T ,
class
Less >
189
std::vector< std::size_t >
longestChainSubsequence
(
const
std::vector< T > & S ,
190
Less less );
191
214
template
<
class
T ,
class
Hash = std::hash< T > >
215
std::pair< std::size_t , std::size_t >
216
longestDistinctSegment
(
const
std::vector< T > & A );
217
218
/*--------------------------------------------------------------------------*/
219
220
}
// end( namespace ADS )
221
222
/*--------------------------------------------------------------------------*/
223
/*-------------------------- IMPLEMENTATION --------------------------------*/
224
/*--------------------------------------------------------------------------*/
225
226
#include "ADS/optimization/impl/SequenceProblems.tpp"
227
228
/*--------------------------------------------------------------------------*/
229
230
#endif
/* SequenceProblems.h included */
231
232
/*--------------------------------------------------------------------------*/
233
/*---------------------- End File SequenceProblems.h -----------------------*/
234
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::maxSumIncreasingSubsequence
T maxSumIncreasingSubsequence(const std::vector< T > &A)
the largest sum of a strictly increasing subsequence of , 0 for the empty one
ADS::largestDivisibleSubset
std::vector< T > largestDivisibleSubset(std::vector< T > A)
a largest subset of in which of any two items one divides the other, sorted
ADS::longestChainSubsequence
std::vector< std::size_t > longestChainSubsequence(const std::vector< T > &S, Less less)
the places of a longest subsequence of each item of which precedes the next by less,...
ADS::trappingRainWater
T trappingRainWater(const std::vector< T > &h)
the water held by the columns of heights , no walls outside
ADS::longestDistinctSegment
std::pair< std::size_t, std::size_t > longestDistinctSegment(const std::vector< T > &A)
the start and the length of the first longest segment of with no value repeated
ADS
Definition
ADT.h:96
ADS
optimization
SequenceProblems.h
Generated by
1.17.0