|
ADS
Algorithms and Data Structures
|
The quicksorts beyond the quicksort of Montresor's book [see QuickSort.h for it and its improvements of section 12.2]: the two of chapter 5, Sorting Atomic Items, of Ferragina's book, and the one engineered for speed, pdqSort(), which is in PdqSort.h [see PdqSort.h, which this header includes]: More...
#include "ADS/Contract.h"#include "ADS/sort/InsertionSort.h"#include "ADS/sort/Sorted.h"#include <algorithm>#include <bit>#include <cstddef>#include <cstdint>#include <functional>#include <type_traits>#include <utility>#include <vector>#include "ADS/sort/impl/EngineeredQuickSorts.tpp"#include "ADS/sort/PdqSort.h"Go to the source code of this file.
Namespaces | |
| namespace | ADS |
Functions | |
| template<SortStore Store, class T = std::ranges::range_value_t< std::remove_cvref_t< Store > >, class C = std::less<>> | |
| void | ADS::dualPivotQuickSort (Store &&A, C less=C()) |
| the dual-pivot quicksort | |
| template<class T, class C = std::less<>> | |
| void | ADS::dualPivotQuickSort (std::vector< T > &A, C less=C()) |
| dualPivotQuickSort() above on a vector | |
| template<SortStore Store, class T = std::ranges::range_value_t< std::remove_cvref_t< Store > >, class C = std::less<>> | |
| void | ADS::threeWayQuickSort (Store &&A, C less=C()) |
| the quicksort with the three-way partition of Ferragina's book | |
| template<class T, class C = std::less<>> | |
| void | ADS::threeWayQuickSort (std::vector< T > &A, C less=C()) |
| threeWayQuickSort() above on a vector | |
| template<SortRange R, class... P> requires requires( std::vector< std::ranges::range_value_t< R > > & v , P &&... p ) { dualPivotQuickSort( v , std::forward< P > ( p )... ); } | |
| decltype(auto) | ADS::dualPivotQuickSort (R &&A, P &&... p) |
| dualPivotQuickSort() on the range \( A \) [see SortRange], the other arguments as for a vector: in place on the span of its items if \( A \) is contiguous, through a vector of its items otherwise, since the code of the sort reads the items by their addresses | |
| template<SortRange R, class... P> requires requires( std::vector< std::ranges::range_value_t< R > > & v , P &&... p ) { threeWayQuickSort( v , std::forward< P >( p )... ); } | |
| decltype(auto) | ADS::threeWayQuickSort (R &&A, P &&... p) |
| threeWayQuickSort() on the range \( A \) [see SortRange], the other arguments as for a vector: in place on the span of its items if \( A \) is contiguous, through a vector of its items otherwise, since the code of the sort reads the items by their addresses | |
The quicksorts beyond the quicksort of Montresor's book [see QuickSort.h for it and its improvements of section 12.2]: the two of chapter 5, Sorting Atomic Items, of Ferragina's book, and the one engineered for speed, pdqSort(), which is in PdqSort.h [see PdqSort.h, which this header includes]:
Both sort in place and are not stable; the recursion goes into the smaller part and loops on the larger, so that the stack stays \( O( \log n ) \).
The contracts [see Contract.h]: each sort ends with the same items sorted, an audit. The functions are defined in EngineeredQuickSorts.tpp.