You are viewing a single comment's thread. Return to all comments →
My C code solution
int* quickSort(int arr_count, int* arr, int* result_count) { *result_count = arr_count; int j = 0,pivot = arr[0]; int* ar = (int*)malloc(arr_count*sizeof(int)); for(int i = 0;i < arr_count;i++){ if(arr[i] < pivot){ ar[j++] = arr[i]; } } ar[j++] = pivot; for(int i = 0;i < arr_count;i++){ if(arr[i] > pivot){ ar[j++] = arr[i]; } } return ar; }
Seems like cookies are disabled on this browser, please enable them to open this website
Quicksort 1 - Partition
You are viewing a single comment's thread. Return to all comments →
My C code solution