#define SIZE 10000000 #define NB_TESTS 4 #include #include #include void sort (int array[],int size); main( ) { int i,t ; long duration[NB_TESTS]; long duration_val; clock_t starttime,endtime ; int *array; for (t=0;tduration[t]) duration_val=duration[t]; printf("%d",duration_val); } static void quicksort ( int array[], int low, int high ) { int pos ; if ( low < high ) { int item, i, j, t ; item = array[low] ; i = low ; j = high ; while ( i < j ) { while ( array[j] > item ) j = j - 1 ; while ( array[i] <= item && i < j ) i = i + 1 ; if ( i < j ) { t = array[i] ; array[i] = array[j] ; array[j] = t ; } } pos = j ; t = array[low] ; array[low] = array[pos] ; array[pos] = t ; quicksort ( array, pos + 1, high ) ; quicksort ( array, low, pos - 1 ) ; } } void sort (int array[],int size) { quicksort ( array, 0, size-1 ) ; }