Program Listing for File StockTrading.h

↰ Return to documentation for file (ADS/optimization/StockTrading.h)

/*--------------------------------------------------------------------------*/
/*-------------------------- File StockTrading.h ---------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef __ADS_StockTrading
 #define __ADS_StockTrading
                      /* self-identification: #endif constant */

/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/Contract.h"

#include <algorithm>
#include <cstddef>
#include <optional>
#include <vector>

/*--------------------------------------------------------------------------*/
/*--------------------------- NAMESPACE ------------------------------------*/
/*--------------------------------------------------------------------------*/

namespace ADS {

template< class T >
T maxProfit( const std::vector< T > & prices , std::size_t k );

template< class T >
std::optional< T > maxProfitExactly( const std::vector< T > & prices ,
                                     std::size_t k );

/*--------------------------------------------------------------------------*/

}  // end( namespace ADS )

/*--------------------------------------------------------------------------*/
/*-------------------------- IMPLEMENTATION --------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/optimization/impl/StockTrading.tpp"

/*--------------------------------------------------------------------------*/

#endif  /* StockTrading.h included */

/*--------------------------------------------------------------------------*/
/*------------------------ End File StockTrading.h -------------------------*/
/*--------------------------------------------------------------------------*/