I need to write a program to test the code below using an aray of 200,000 integers. I also need to use the clock() function before and after the call to QuickSort and subtract to calculate the CPU time spent sorting. This program needs to run this time trial 10 times. Here is the QuickSort/InsertionSort program. Thanks so much for your help.
Keat.
void Quicksort(dataType A[], int F, int L)
{
int PivotIndex;
if (F<L)
{
//is this a small region???
if ((L - F) < Cutoff) {
//yes.....so use InsertionSort
InsertionSort(A, F, L)
}
else
{
//no...do normal QuickSort
Partition(A, F, L, PivotIndex)
Quicksort(A, F, PivotIndex-1)
Quicksort(A, PivotIndex+1, L);
}
}
}
Keat.
void Quicksort(dataType A[], int F, int L)
{
int PivotIndex;
if (F<L)
{
//is this a small region???
if ((L - F) < Cutoff) {
//yes.....so use InsertionSort
InsertionSort(A, F, L)
}
else
{
//no...do normal QuickSort
Partition(A, F, L, PivotIndex)
Quicksort(A, F, PivotIndex-1)
Quicksort(A, PivotIndex+1, L);
}
}
}