however i can't put it in the function because it recursive so it will output me multiple times in seconds, can anyone suggest a solution or should i make a function that does this and in main put my sort function in between begin=clock and end=clock
quickSort(T arr[], int left, int right) {
int i = left, j = right;
int tmp;
int pivot = arr[(left + right) / 2];
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);