The quick sort is to find a datum point first, then put the smaller than it to the left (ascending sort), put bigger than it to the right, and then put the datum point to the middle, the last two parts of the array to do the same steps to complete the quick sorting. The program is done in a recursive manner.
Here is the code
#include <stdio.h>void quicksort (int src[], int Left, int right) {if (left >= right) return;int l = left;int r = right;int key = src[left];while (L < r) {while (key <= src[r] && l<r) r--;src[l] = src[r];while (key >= SRC[L]&NBSP;&&&NBSP;L<R) l++;src[r] = src[l];} Src[l] = key;quicksort (src, left, l - 1); Quicksort (Src, l + 1, right);} Int main () {int i;int a[] = { 1, 5, 6, 3, 4, 9, 95, 32, 56, 45 };quicksort (A, 0, sizeof (a) / sizeof (A[0])-1);for (i = 0; i < sizeof (a) / sizeof (a[0]); i++) printf ("%d ", a[i]); System ("pause"); return 0;}
Quickly sort a shaped array