19 ms·
There is an algorithm for calculating median in O(n). I was wondering if choosing a pivot that is always a median would speed up quicksort. In theory it should
by fridek 15y ago
There is an algorithm for calculating median in O(n). I was wondering if choosing a pivot that is always a median would speed up quicksort. In theory it should always give O(n log n) time, as recursive calls would always take a half of input array.