Working of Quick Sort Algorithm
QuickSort works on divide and conquer. It takes one element as a pivot and moves it to the correct position in a way that all elements at left are smaller and all elements at right are greater than the pivot and hence partitions the array at the pivot and again applies the same for the created partition subarray as shown below…