StudentSquare.in

Quick Sort Part-2


Detailed Discussion


1)What is Quick Sort ?
  Quick sort is one of the fastest sorting technique that use divide-and-conquer approach of problem-solving. Quick sort 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..

2)Write the Quick Sort Algorithm.
  Quick Sort

  Here Algorithm Quick is used to placed the Pivot element to it's actual position in the array. Quick Sort
  Here Algorithm Quick Sort is used to sort the entire array by calling Quick Algorithm multiple times. First Algorithm Quick placed the Pivot element it's actual position in the array and creats two sub arrays ( Left sub-array and Right sub-array). For next time calling of Quick algorithm, the Pivot of Right sub-array will placed it's actual position in the array and again creats two sub-arrays. These process will continue till the entire array will not sort.

3)What is the complexity of Quick Sort ?
  Time Complexity of worst case is of Ο(n^2) where n is the number of items. But Time Complexity of average & best case is of Ο(n log n) where n is the number of items.

4)What are the applications of Quick Sort algorithm?
 
 Quicksort algorithm is used when