57#ifndef __ADS_QuickSort
58 #define __ADS_QuickSort
109 class T = std::ranges::range_value_t< std::remove_cvref_t< Store > > ,
110 class C = std::less<> >
111std::size_t
partition( Store && A , std::size_t start , std::size_t end ,
115template<
class T ,
class C = std::less<> >
116std::size_t
partition( std::vector< T > & A , std::size_t start ,
117 std::size_t end , C less = C() );
149 class T = std::ranges::range_value_t< std::remove_cvref_t< Store > > ,
150 class C = std::less<> >
153 const T & x , C less = C() );
156template<
class T ,
class C = std::less<> >
158 std::size_t end ,
const T & x , C less = C() );
179 class T = std::ranges::range_value_t< std::remove_cvref_t< Store > > ,
180 class C = std::less<> >
181void quickSort( Store && A , std::size_t start , std::size_t end ,
185template<
class T ,
class C = std::less<> >
186void quickSort( std::vector< T > & A , std::size_t start , std::size_t end ,
199 class T = std::ranges::range_value_t< std::remove_cvref_t< Store > > ,
200 class C = std::less<> >
204template<
class T ,
class C = std::less<> >
250 class T = std::ranges::range_value_t< std::remove_cvref_t< Store > > ,
251 class C = std::less<> >
253 std::size_t * depth =
nullptr );
256template<
class T ,
class C = std::less<> >
258 C less = C() , std::size_t * depth =
nullptr );
283template<
class T ,
class C = std::less<> >
295 requires requires( std::vector< std::ranges::range_value_t< R > > & v ,
297{
quickSort( v , std::forward< P >( p )... ); }
300 const auto f = [ & ](
auto & v ) ->
decltype(
auto ) {
301 return(
quickSort( v , std::forward< P >( p )... ) );
303 return( detail::sortRange( A , f , f ) );
310template< SortRange R ,
class... P >
311 requires requires( std::vector< std::ranges::range_value_t< R > > & v ,
318 const auto f = [ & ](
auto & v ) ->
decltype(
auto ) {
321 return( detail::sortRange( A , f , f ) );
332#include "ADS/sort/impl/QuickSort.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
Insertion Sort (section 2.7.2), as one sorts a hand of cards: is inserted in the sorted prefix ,...
The LIST of the book: a SEQUENCE [see ADT.h] realized as a bidirectional circular list of cells with ...
The checks of the contracts of the sorts [see Contract.h]: a copy of the input kept only when the aud...
a SEQUENCE realized as a bidirectional circular list with a sentinel, its cells from a pool if Pooled
Definition List.h:118
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::optional< Nodes > partition(const std::vector< long > &A)
the places of a half of of half the sum, or nothing
void quickSortTuned(Store &&A, std::size_t cutoff=16, C less=C(), std::size_t *depth=nullptr)
Quicksort with the improvements of section 12.2; the largest number of parts on the stack goes to *de...
std::size_t partitionByValue(Store &&A, std::size_t start, std::size_t end, const T &x, C less=C())
the partition of around a value that need not be in it, in one pass from both ends: the items not l...
void quickSort(Store &&A, std::size_t start, std::size_t end, C less=C())
the sort of , the QuickSort() of the book