설명#
The quick sort is an inplace, divideandconquer, massively recursive sort. As a normal person would say, it's essentially a faster inplace version of the merge sort. The quick sort algorithm is simple in theory, but very difficult to put into code (computer scientists tied themselves into knots for years trying to write a practical implementation of the algorithm, and it still has that effect on university students).The recursive algorithm consists of four steps (which closely resemble the merge sort):
1. If there are one or less elements in the array to be sorted, return immediately. 2. Pick an element in the array to serve as a "pivot" point. (Usually the leftmost element in the array is used.) 3. Split the array into two parts  one with elements larger than the pivot and the other with elements smaller than the pivot. 4. Recursively repeat the algorithm for both halves of the original array.
The efficiency of the algorithm is majorly impacted by which element is choosen as the pivot point. The worstcase efficiency of the quick sort, O(n2), occurs when the list is sorted and the leftmost element is chosen. Randomly choosing a pivot point rather than using the leftmost element is recommended if the data to be sorted isn't random. As long as the pivot point is chosen randomly, the quick sort has an algorithmic complexity of O(n log n).
The quick sort is by far the fastest of the common sorting algorithms. It's possible to write a specialpurpose sorting algorithm that can beat the quick sort for some data sets, but for generalcase sorting there isn't anything faster.
As soon as students figure this out, their immediate implulse is to use the quick sort for everything  after all, faster is better, right? It's important to resist this urge  the quick sort isn't always the best choice. As mentioned earlier, it's massively recursive (which means that for very large sorts, you can run the system out of stack space pretty easily). It's also a complex algorithm  a little too complex to make it practical for a onetime sort of 25 items, for example.
With that said, in most cases the quick sort is the best choice if speed is important (and it almost always is). Use it for repetitive sorting, sorting of medium to large lists, and as a default choice when you're not really sure which sorting algorithm to use. Ironically, the quick sort has horrible efficiency when operating on lists that are mostly sorted in either forward or reverse order  avoid it in those situations.
 장점: 굉장히 빠름.
 단점: 매우 복잡한 알고리즘이고 재귀적이다.
실행횟수
O(n log n)
자바 소스#
public class QuickSort {

효율성#