void quickSort(int arr[], int left, int right)
{
int i = left, j = right;
int tmp;
int pivot = arr[(left + right) / 2];
/* partition */
while (i <= j)
{
while (arr[i] < pivot)
i++;
while (arr[j] > pivot)
j--;
if (i <= j)
{
tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
i++;
j--;
}
};
/* recursion */
if (left < j)
quickSort(arr, left, j);
if (i < right)
quickSort(arr, i, right);
}
if you guys know how to convert the quicksort so it will accept my arrays that would be great. thanks.
Wait, what are you sorting here? If it's numerical, I know that there's a function in the algorithm library that does it for you... Also, in the case of dynamic arrays, you already know the values of humDice and posDice, since they have to be sent specifically to those functions to create arrays... can't you just pass their values over to quickSort as well?