What is sorting? ,what is quicksort? ,quicksort method ,choice of pivot ,determine the pivot ,quicksort algorithm ,partition code ,partition example ,quicksort pseudocode ,quicksort implementation ,quicksort complexities ,quicksort uses ,review ,summary
2. INTRODUCTIO
N
What is sorting?
Sorting breaks large data into smaller data units.
What is quicksort?
Arranges the element of array systematically or orderly.
The order could be ascending (moving from less to greater) or
descending (moving from greater to less).
Quicksort (sometimes called partition-exchange sort) is an efficient
sorting algorithm.
4. Choice of Pivot
Determine the pivot :
Many different approaches
The first element of the current sub-array
The last element
The middle element
The median of first , middle and last elements
Randomly choose an element
5. Quicksort Algorithm
Using pivot algorithm recursively, we end up with smaller possible partitions. Each partition is
then processed for quick sort. We define recursive algorithm for quicksort as follows −
Step 1 − Make the right-most index value pivot
Step 2 − partition the array using pivot value Step
3 − quicksort left partition recursively Step 4 −
quicksort right partition recursively
15. REVIE
W
What will be the worst case for the algorithm?
Partition is always unbalanced
What will be the best case for the algorithm?
Partition is balanced
16. SUMMAR
Y
In worst case efficiency is O(n2)
---But easy to avoid the worst case
On average efficiency is O(n log n)
Better space complexity than merge sort
In practice , runs fast and widely used