Quick Sort is a highly efficient sorting algorithm that uses the Divide and Conquer strategy.
It works by selecting a pivot element, then partitioning the array into two parts:
- Elements smaller than the pivot
- Elements greater than the pivot
This process is repeated recursively until the whole array is sorted.
- Fast and efficient for large datasets
- In-place sorting (requires minimal extra memory)
- Based on recursion and partitioning
| Case | Complexity |
|---|---|
| Best | O(n log n) |
| Average | O(n log n) |
| Worst | O(nΒ²) |
- Choose a pivot
- Partition elements around the pivot
- Recursively sort left and right partitions
Simply run the program to see the array before and after sorting using Quick Sort.
