Quick sort

Quicksort (sometimes called partition-exchange sort) is an O(N log N) efficient sorting algorithm, serving as a systematic method for placing the elements of an array in order. Developed by British computer scientist Tony Hoare in 1959[1] and published in 1961,[2] it is still a commonly used algorithm for sorting. When implemented well, it can be about two or three times faster than its main competitors, merge sort and heapsort.[3][contradictory] Quicksort is a comparison sort, meaning that it can sort items of any type for which a "less-than" relation (formally, a total order) is defined. In efficient implementations it is not a stable sort, meaning that the relative order of equal sort items is not preserved. Quicksort can operate in-place on an array, requiring small additional amounts of memory to perform the sorting. It is very similar to selection sort, except that it does not always choose worst-case partition.

Clicking on this step you can see the Create code learningstep of the algorithm.

Animation
Current movement:
Code

Everything is awesome!

void quick_sort(int a[], int i, int j){

if ( i < j ){

int k = pre_sort(a,i,j);

quick_sort( a, , );

quick_sort( a, , );

}

}

int pre_sort (int a[], int i, int j){

int temp, pivot = a[i];

while ( i < j ){

if ( a[i] > a[j] ) {temp = a[i]; a[i] = a[j]; a[j] = temp;}

else if ( a[i] == pivot ) {++i;}

else {--j;}

}

return i;

}

Hints

You're awesome! No need for help!