Description: quickSort(快速排序) is a fast sorting algorithm, which is widely applied in practice. It is used on the principle of divide-and-conquer. quickSort works by partitioning a given array A[p . . r] into two non-empty sub-arrays A[p . . q] and A[q+1 . . r] such that every element in A[p . . q] is less than or equal to every element in A[q+1 . . r]. Then the two sub-arrays are sorted by recursive calls to quickSort. The details of quickSort are described as follows:
1. Choose a pivot value(基准). You may take the value of the first element as
pivot value, but it can be any value, which is in range of sorted values, even if it doesn t present in the array.
2. Partition(划分). Rearrange elements in such a way that all elements which are lesser than the pivot go to the left part of the array, and all elements greater than the pivot go to the right part of the array. Values equal to the pivot can stay in any position of the array.
3. Sort both sub-arrays. Apply quicksort algorithm recursively to the
To Search:
File list (Check if you may need any files):
Ex1\main.cpp
...\QuickSort.exe
Ex1