53#ifndef __ADS_ShellSort
54 #define __ADS_ShellSort
79inline std::vector< std::size_t >
knuthGaps( std::size_t n );
84inline std::vector< std::size_t >
shellGaps( std::size_t n );
89inline std::vector< std::size_t >
hibbardGaps( std::size_t n );
93inline std::vector< std::size_t >
prattGaps( std::size_t n );
98inline std::vector< std::size_t >
ciuraGaps( std::size_t n );
120 class T = std::ranges::range_value_t< std::remove_cvref_t< Store > > ,
121 class C = std::less<> >
122void shellSort( Store && A ,
const std::vector< std::size_t > & gaps ,
126template<
class T ,
class C = std::less<> >
128 const std::vector< std::size_t > & gaps ,
139 class T = std::ranges::range_value_t< std::remove_cvref_t< Store > > ,
140 class C = std::less<> >
144template<
class T ,
class C = std::less<> >
156 requires requires( std::vector< std::ranges::range_value_t< R > > & v ,
158{
shellSort( v , std::forward< P >( p )... ); }
161 const auto f = [ & ](
auto & v ) ->
decltype(
auto ) {
162 return(
shellSort( v , std::forward< P >( p )... ) );
164 return( detail::sortRange( A , f , f ) );
175#include "ADS/sort/impl/ShellSort.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The checks of the contracts of the sorts [see Contract.h]: a copy of the input kept only when the aud...
the storage on which the sorts of the book work in place, which read the items by their ranks only: a...
Definition Sorted.h:184
a range that the sorts take beside std::vector and std::span: random access, sized,...
Definition Sorted.h:153
std::vector< std::size_t > prattGaps(std::size_t n)
the gaps up to , increasing
std::vector< std::size_t > shellGaps(std::size_t n)
the gaps of Shell, each half the next one, increasing
void shellSort(Store &&A, const std::vector< std::size_t > &gaps, C less=C())
the Shell Sort with the given gaps, increasing and starting from 1
std::vector< std::size_t > knuthGaps(std::size_t n)
the gaps , below ( ), increasing
std::vector< std::size_t > hibbardGaps(std::size_t n)
the gaps below ( ), increasing
std::vector< std::size_t > ciuraGaps(std::size_t n)
the gaps of Ciura below , and then each times the one before, increasing