Bio/Cluster/mysort.h
/* Another way to choose pivot is using median of left, middle, and right values*/
Another way to choose pivot is using median of left, middle, and right values
Another way to choose pivot is using median of left middle and right values
inline int
median_index_of3(const double arr[], const int a, const int b, const int c)
{
	if (arr[a] < arr[b]) {
		if (arr[b] < arr[c]) return b;
		else if (arr[a] < arr[c]) return c;
		else return a;
	}
	else {
		if (arr[a] < arr[c]) return a;
		else if (arr[b] < arr[c]) return c;
		else return b;
	}
}
inline int median_index_of3 ( const double arr [ ] , const int a , const int b , const int c ) { if ( arr [ a ] < arr [ b ] ) { if ( arr [ b ] < arr [ c ] ) return b ; else if ( arr [ a ] < arr [ c ] ) return c ; else return a ; } else { if ( arr [ a ] < arr [ c ] ) return a ; else if ( arr [ b ] < arr [ c ] ) return c ; else return b ; } }
Another way to choose pivot is using median of left, middle, and right values
Another way to choose pivot is using median of left middle and right values