Quick sort is an improvement on bubble sort. Its implementation principle is to divide the unsorted elements into two subsequences based on a "pivot" as a benchmark. The records in one of the subsequences are larger than the main element. element, and the other subsequence is smaller than the pivot element, and then the two subsequences are sorted recursively using a similar method.
Quick sort
Divides unsorted elements into categories based on a "pivot" as a basis Two subsequences, one of which has records greater than the pivot, while the other subsequence is smaller than the pivot, then recursively sort the two subsequences in a similar way
Time complexity:O(Nlog2N)
Introduction:
Quicksort is an improvement on bubble sort.
Quick sort was proposed by C. A. R. Hoare in 1960. Its basic idea is to divide the data to be sorted into two independent parts through one sorting. All the data in one part is smaller than all the data in the other part, and then the two parts of the data are processed separately according to this method. Sorting, the entire sorting process can be performed recursively, so that the entire data becomes an ordered sequence.
The above is the detailed content of What does quick sort mean?. For more information, please follow other related articles on the PHP Chinese website!