Quick-sort
Quick-sort
Quick Sort is a widely-used, efficient sorting algorithm based on the Divide and
Conquer paradigm. Invented by Tony Hoare in 1960, it is particularly appreciated for
its average-case time complexity of O(nlogn). Quick Sort operates by selecting a
pivot element, partitioning the array into two sub-arrays around the pivot, and then
recursively sorting these sub-arrays.
KEY CONCEPTS OF QUICK SORT ALGORITHM?
Because Quict Sort is a recursion algorithm, we will repeat the same process
HOW TO CHOOSE THE PIVOT?
HOW TO CHOOSE THE PIVOT?
A popular method is called the “median-of-three”
It is a method where we look at the first, middle, and last elements of the array
We sort them properly and choose the middle item as our pivot
PSEUDOCODE FOR QUICKSORT
CONCLUSION
CONCLUSION
Quick Sort is an efficient and widely used algorithm with a well-balanced tradeoff
between complexity and performance. While Quick Sort is not stable and may have
limitations in scenarios requiring guaranteed efficiency for all input types, strategies
like random pivot selection or hybrid methods (e.g., Introsort) help mitigate these
drawbacks. Overall, Quick Sort remains one of the most widely used sorting
algorithms due to its balance of speed, memory efficiency, and implementation
simplicity.
SOURCE
THANK YOU!