Program Listing for File Selection.h

↰ Return to documentation for file (ADS/search/Selection.h)

/*--------------------------------------------------------------------------*/
/*---------------------------- File Selection.h ----------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/

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

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

#include "ADS/Contract.h"
#include "ADS/sort/InsertionSort.h"
#include "ADS/sort/QuickSort.h"

#include <algorithm>
#include <cstddef>
#include <random>
#include <utility>
#include <vector>

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

namespace ADS {

template< class T , class R = std::mt19937 >
T selection( std::vector< T > & A , std::size_t k , R * rng = nullptr );

template< class T >
T medianOfMedians( std::vector< T > & A , std::size_t k );

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

}  // end( namespace ADS )

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

#include "ADS/search/impl/Selection.tpp"

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

#endif  /* Selection.h included */

/*--------------------------------------------------------------------------*/
/*-------------------------- End File Selection.h --------------------------*/
/*--------------------------------------------------------------------------*/