Program Listing for File KnuthSorts.h

↰ Return to documentation for file (ADS/sort/KnuthSorts.h)

/*--------------------------------------------------------------------------*/
/*--------------------------- File KnuthSorts.h ----------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/

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

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

#include "ADS/Contract.h"
#include "ADS/sort/RadixSort.h"
#include "ADS/sort/Sorted.h"

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <functional>
#include <optional>
#include <type_traits>
#include <utility>
#include <vector>

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

namespace ADS {

template< class T , class C = std::less<> >
void binaryInsertionSort( std::vector< T > & A , C less = C() );

template< class T , class C = std::less<> >
void listInsertionSort( std::vector< T > & A , C less = C() ,
                        std::size_t * moves = nullptr );

template< class T >
void addressCalculationSort( std::vector< T > & A , std::size_t M = 0 );

template< RadixKey T >
void radixExchangeSort( std::vector< T > & A );

template< class T , class C = std::less<> >
void tournamentSort( std::vector< T > & A , C less = C() );

template< class T , class C = std::less<> >
void mergeInsertionSort( std::vector< T > & A , C less = C() );

inline long fordJohnsonBound( std::size_t n );

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

}  // end( namespace ADS )

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

#include "ADS/sort/impl/KnuthSorts.tpp"

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

#endif  /* KnuthSorts.h included */

/*--------------------------------------------------------------------------*/
/*------------------------- End File KnuthSorts.h --------------------------*/
/*--------------------------------------------------------------------------*/