
Quick sort
Random shuffle is a key for good performance in the quick sort algorithm because it guarantees that the worst case isn't gonna happen(rarely happens).
Tuned quicksort for primitive types;
Worst Case: Array already sorted takes O(n^2) - imp slide # 18
Time Complexity
Best Case: O(nlogn)
Average Case: O(nlogn)
Worst Case: O(n2) (low probability due to randomization)
Randomization helps ensure that the algorithm performs closer to the average case most of the time, providing reliable performance in practical scenarios.
Find kth-Smallest Element using the QuickSelect Algorithm
Description: Implement a program to find the kth smallest element in an unsorted array efficiently using the QuickSelect algorithm, a quicksort algorithm variation. This algorithm allows for finding the kth smallest element in linear time complexity on average.

Last updated
Was this helpful?






