Program Listing for File ShellSort.h
↰ Return to documentation for file (ADS/sort/ShellSort.h)
/*--------------------------------------------------------------------------*/
/*---------------------------- File ShellSort.h ----------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/
#ifndef __ADS_ShellSort
#define __ADS_ShellSort
/* self-identification: #endif constant */
/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/
#include "ADS/Contract.h"
#include "ADS/sort/Sorted.h"
#include <algorithm>
#include <cstddef>
#include <functional>
#include <vector>
/*--------------------------------------------------------------------------*/
/*--------------------------- NAMESPACE ------------------------------------*/
/*--------------------------------------------------------------------------*/
namespace ADS {
inline std::vector< std::size_t > knuthGaps( std::size_t n );
inline std::vector< std::size_t > shellGaps( std::size_t n );
inline std::vector< std::size_t > hibbardGaps( std::size_t n );
inline std::vector< std::size_t > prattGaps( std::size_t n );
inline std::vector< std::size_t > ciuraGaps( std::size_t n );
template< class T , class C = std::less<> >
void shellSort( std::vector< T > & A ,
const std::vector< std::size_t > & gaps , C less = C() );
template< class T , class C = std::less<> >
void shellSort( std::vector< T > & A , C less = C() );
/*--------------------------------------------------------------------------*/
} // end( namespace ADS )
/*--------------------------------------------------------------------------*/
/*-------------------------- IMPLEMENTATION --------------------------------*/
/*--------------------------------------------------------------------------*/
#include "ADS/sort/impl/ShellSort.tpp"
/*--------------------------------------------------------------------------*/
#endif /* ShellSort.h included */
/*--------------------------------------------------------------------------*/
/*-------------------------- End File ShellSort.h --------------------------*/
/*--------------------------------------------------------------------------*/