|
ADS
Algorithms and Data Structures
|
Two problems on a sequence \( A[ 0 .. n - 1 ] \) solved by the dynamic programming of chapter 13: More...
#include "ADS/Contract.h"#include <algorithm>#include <cstddef>#include <vector>#include "ADS/algorithm/impl/Subsequences.tpp"Go to the source code of this file.
Namespaces | |
| namespace | ADS |
Functions | |
| template<class T> | |
| std::vector< T > | ADS::lis (const std::vector< T > &A) |
| a longest increasing subsequence, \( O( n^2 ) \) | |
| template<class T> | |
| std::size_t | ADS::lisLength (const std::vector< T > &A) |
| the length of a longest increasing subsequence, \( O( n \log n ) \) | |
| template<class T> | |
| T | ADS::maxSubarraySum (const std::vector< T > &A) |
| the largest sum of a subvector, the empty one included, \( O( n ) \) | |
Two problems on a sequence \( A[ 0 .. n - 1 ] \) solved by the dynamic programming of chapter 13:
The contracts [see Contract.h]: lis() gives a strictly increasing subsequence of \( A \), as long as lisLength() says, an audit; maxSubarraySum() is never negative, the empty subvector counting 0. The functions are defined in Subsequences.tpp.