Working of Quick Sort
- A pivot element is selected and the array is divided into subarrays (elements selected from the array).
- While dividing the array, the pivot element should be positioned in such a way that elements less than pivot element are kept on the left side and elements greater than pivot element are on the right side.
- The same approach is used to divide left and right subarrays. Until each subarray contains a single element this process continues.
- In the end, the elements are combined to form a sorted array.
8
