I am confused of the explaination ============================================= Direct application of the quick sort based selection algorithm The quick sort based selection algorithm can be used to find k smallest or k largest elements. To find k smallest elements find the kth smallest element using the median of medians quick sort based algorithm. After the partition that finds the kth smallest element, all the elements smaller than the kth smaller element will be present left to the kth eleme
它这里是说,如果用一个random的pivot,worse case可能是O(n^2), 而用median of median找到一个好的pivot,需要O(n),再应用Select找 k-th element,这里主要是花在partition上面,也是O(n),worse case 也是O(n),那么 (k-1) smallest/largest elements就在k-th的左/右边.
【在 l*****a 的大作中提到】 : I am confused of the explaination : ============================================= : Direct application of the quick sort based selection algorithm : The quick sort based selection algorithm can be used to find k smallest or : k largest elements. To find k smallest elements find the kth smallest : element using the median of medians quick sort based algorithm. After the : partition that finds the kth smallest element, all the elements smaller : than the kth smaller element will be present left to the kth eleme