57#ifndef __ADS_MasterTheorem
58 #define __ADS_MasterTheorem
89 [[nodiscard]]
double at(
double n )
const {
90 return( std::pow(
c , n ) * std::pow( n ,
p ) * std::pow( std::log( n ) ,
92 std::pow( std::log( std::log( n ) ) ,
r ) );
99 for(
auto [ x , y ] : { std::pair( a.
c , b.
c ) , std::pair( a.
p , b.
p ) ,
100 std::pair( a.
q , b.
q ) , std::pair( a.
r , b.
r ) } )
103 return( std::partial_ordering::equivalent );
109 return( ( a <=> b ) == 0 );
137inline Growth master(
double a ,
double b ,
double beta ,
double k = 0 );
164#include "ADS/algorithm/impl/MasterTheorem.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
Growth linear(double a, double beta)
the order of ,
Growth master(double a, double b, double beta, double k=0)
the order of ; within of an integer is taken as that integer ( is 3, not 2.9999999999999996),...
the order , and whether it is only an upper bound
Definition MasterTheorem.h:81
double r
the power of
Definition MasterTheorem.h:85
friend std::partial_ordering operator<=>(const Growth &a, const Growth &b)
the order of the two functions for large: lexicographic on , , and (upper is not compared)
Definition MasterTheorem.h:97
double c
the base of the exponential
Definition MasterTheorem.h:82
bool upper
rather than
Definition MasterTheorem.h:86
double q
the power of
Definition MasterTheorem.h:84
double at(double n) const
the value of the order at , for
Definition MasterTheorem.h:89
friend bool operator==(const Growth &a, const Growth &b)
true if the two orders are the same, i.e., if operator<=> finds them equivalent
Definition MasterTheorem.h:108
double p
the power of
Definition MasterTheorem.h:83