Quick sort is a divide-and-conquer sorting algorithm that works by selecting a "pivot" element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater
than the pivot. The sub-arrays are then sorted recursively.
The time complexity of quick sort is O(n log n) on average, but O(n^2) in the worst case.