Code:
void Partition(int low, int high, int S[])
{
int i, j;
int pivotpoint, pivotitem;
pivotitem = S[low];
j = low;
for(i = low + 1; i <= high; i++)
if (S[i] < pivotitem) {
j++;
Swap(S[i], S[j]);
}
pivotpoint = j;
Swap(S[low], S[pivotpoint]);
}
//***********************************************************************************
void QuickSort(int low, int high)
{
int pivotpoint;
if(high > low) {
Partition(low,high,pivotpoint);
QuickSort(low, pivotpoint - 1);
QuickSort(pivotpoint + 1, high);
}
}
Pivotpoint is NOT the right argument for Partition.
Code:
MergeSort(n, S_1);
QuickSort(low, high, S_2);
StringOutput("\nUnsorted, the array is: \n\n");
OutputArray(n, S_0);
low and high are not present in the function. What do you think you need to pass to start a sort off?
S_2 is passed to the function, but the function only takes 2 arguments.
--
Mats