Quick Sort is run on two inputs shown below to sort in ascending order:
(i) 1.2,3 .....n
(ii) n,n-l,n-2.....2,1
let C1 and C2 be the number of comparisions made for the inputs (i) and (ii)respectively then
Quick Sort is run on two inputs shown
below to sort in ascending order:
(i) 1.2,3 .....n
(ii) n,n-l,n-2.....2,1
let C1and C2be the
number of comparisons made for the inputs (i) and (ii)respectively then C1=C2.
Quick sort is a Divide and Conquer algorithm. It is a highly efficient sorting algorithm and is based on partitioning of array of data into smaller arrays. A large array is partitioned into two arrays one of which holds values smaller than the specified value, say pivot, based on which the partition is made and another array holds values greater than the pivot value.