Scortch/sort.c
///	Quick sort identifies a pivot element then swaps elements on the wrong side of the pivot
Quick sort identifies a pivot element then swaps elements on the wrong side of the pivot
Quick sort identifies a pivot element then swaps elements on the wrong side of the pivot
void quickSort(void *array, size_t count, size_t size, void *temporary, struct SortingStatistics *statistics, Compare compare, void *context) {
	if ( count < 2 ) {
		return;
	} else if ( count < 16 ) {
		binaryInsertionSort(array, count, size, 1, temporary, statistics, compare, context);
	} else {
		size_t pivot = quickPartition(array, count, size, temporary, statistics, compare, context);
		quickSort(array, pivot, size, temporary, statistics, compare, context);
		quickSort(array + pivot * size, count - pivot, size, temporary, statistics, compare, context);
	}
}
void quickSort ( void * array , size_t count , size_t size , void * temporary , struct SortingStatistics * statistics , Compare compare , void * context ) { if ( count < 2 ) { return ; } else if ( count < 16 ) { binaryInsertionSort ( array , count , size , 1 , temporary , statistics , compare , context ) ; } else { size_t pivot = quickPartition ( array , count , size , temporary , statistics , compare , context ) ; quickSort ( array , pivot , size , temporary , statistics , compare , context ) ; quickSort ( array + pivot * size , count - pivot , size , temporary , statistics , compare , context ) ; } }
Quick sort identifies a pivot element then swaps elements on the wrong side of the pivot
Quick sort identifies a pivot element then swaps elements on the wrong side of the pivot