Back to Academy
sorting
Quick Sort
Quick Sort is a divide-and-conquer algorithm that picks a 'pivot' element and partitions the array around it, placing smaller elements before and larger elements after the pivot. It then recursively sorts the sub-arrays.
Use Cases
- •General-purpose sorting with good average performance
- •In-place sorting when memory is constrained
- •Large datasets where average-case O(n log n) is acceptable
Complexity Analysis
| Metric | Best | Average | Worst |
|---|---|---|---|
| Time | O(n log n) | O(n log n) | O(n²) |
| Space | O(log n) | ||
Visualization
64
34
25
12
22
11
90
Implementation
Output
Click "Run Code" to see output...